#include "content/web_test/renderer/web_frame_test_proxy.h"
#include "base/memory/raw_ptr.h"
#include "components/plugins/renderer/plugin_placeholder.h"
#include "content/public/renderer/render_frame_observer.h"
#include "content/web_test/common/web_test_string_util.h"
#include "content/web_test/renderer/blink_test_helpers.h"
#include "content/web_test/renderer/event_sender.h"
#include "content/web_test/renderer/gc_controller.h"
#include "content/web_test/renderer/layout_dump.h"
#include "content/web_test/renderer/spell_check_client.h"
#include "content/web_test/renderer/test_plugin.h"
#include "content/web_test/renderer/test_runner.h"
#include "third_party/blink/public/common/loader/referrer_utils.h"
#include "third_party/blink/public/common/unique_name/unique_name_helper.h"
#include "third_party/blink/public/web/web_console_message.h"
#include "third_party/blink/public/web/web_frame_widget.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_navigation_type.h"
#include "third_party/blink/public/web/web_plugin_params.h"
#include "third_party/blink/public/web/web_print_params.h"
#include "third_party/blink/public/web/web_testing_support.h"
#include "third_party/blink/public/web/web_view.h"
namespace content {
namespace {
std::string DescriptionSuitableForTestResult(const std::string& url) { … }
std::string URLSuitableForTestResult(const std::string& url) { … }
bool IsLocalHost(const std::string& host) { … }
bool IsTestHost(const std::string& host) { … }
bool HostIsUsedBySomeTestsToGenerateError(const std::string& host) { … }
const char kLinkClickedString[] = …;
const char kFormSubmittedString[] = …;
const char kBackForwardString[] = …;
const char kReloadString[] = …;
const char kFormResubmittedString[] = …;
const char kOtherString[] = …;
const char* WebNavigationTypeToString(blink::WebNavigationType type) { … }
void PrintFrameUserGestureStatus(WebFrameTestProxy* frame_proxy,
blink::WebLocalFrame* frame,
const char* msg) { … }
class TestRenderFrameObserver : public RenderFrameObserver { … };
}
WebFrameTestProxy::WebFrameTestProxy(RenderFrameImpl::CreateParams params,
TestRunner* test_runner)
: … { … }
WebFrameTestProxy::~WebFrameTestProxy() { … }
void WebFrameTestProxy::Initialize(blink::WebFrame* parent) { … }
void WebFrameTestProxy::Reset() { … }
std::string WebFrameTestProxy::GetFrameNameForWebTests() { … }
std::string WebFrameTestProxy::GetFrameDescriptionForWebTests() { … }
blink::WebPlugin* WebFrameTestProxy::CreatePlugin(
const blink::WebPluginParams& params) { … }
void WebFrameTestProxy::DidAddMessageToConsole(
const blink::WebConsoleMessage& message,
const blink::WebString& source_name,
unsigned source_line,
const blink::WebString& stack_trace) { … }
void WebFrameTestProxy::DidStartLoading() { … }
void WebFrameTestProxy::DidStopLoading() { … }
void WebFrameTestProxy::DidChangeSelection(bool is_selection_empty,
blink::SyncCondition force_sync) { … }
void WebFrameTestProxy::DidChangeContents() { … }
blink::WebEffectiveConnectionType
WebFrameTestProxy::GetEffectiveConnectionType() { … }
void WebFrameTestProxy::UpdateContextMenuDataForTesting(
const blink::ContextMenuData& context_menu_data,
const std::optional<gfx::Point>& location) { … }
void WebFrameTestProxy::DidDispatchPingLoader(const blink::WebURL& url) { … }
std::optional<blink::WebURL> WebFrameTestProxy::WillSendRequest(
const blink::WebURL& target,
const blink::WebSecurityOrigin& security_origin,
const net::SiteForCookies& site_for_cookies,
ForRedirect for_redirect,
const blink::WebURL& upstream_url) { … }
void WebFrameTestProxy::FinalizeRequest(blink::WebURLRequest& request) { … }
void WebFrameTestProxy::BeginNavigation(
std::unique_ptr<blink::WebNavigationInfo> info) { … }
void WebFrameTestProxy::PostAccessibilityEvent(const ui::AXEvent& event) { … }
void WebFrameTestProxy::HandleAXObjectDetachedForTest(unsigned axid) { … }
void WebFrameTestProxy::HandleWebAccessibilityEventForTest(
const blink::WebAXObject& object,
const char* event_name,
const std::vector<ui::AXEventIntent>& event_intents) { … }
void WebFrameTestProxy::HandleWebAccessibilityEventForTest(
const ui::AXEvent& event) { … }
void WebFrameTestProxy::CheckIfAudioSinkExistsAndIsAuthorized(
const blink::WebString& sink_id,
blink::WebSetSinkIdCompleteCallback completion_callback) { … }
void WebFrameTestProxy::DidClearWindowObject() { … }
void WebFrameTestProxy::DidCommitNavigation(
blink::WebHistoryCommitType commit_type,
bool should_reset_browser_interface_broker,
const blink::ParsedPermissionsPolicy& permissions_policy_header,
const blink::DocumentPolicyFeatureState& document_policy_header) { … }
void WebFrameTestProxy::OnDeactivated() { … }
void WebFrameTestProxy::OnReactivated() { … }
void WebFrameTestProxy::BlockTestUntilStart() { … }
void WebFrameTestProxy::StartTest() { … }
blink::FrameWidgetTestHelper*
WebFrameTestProxy::GetLocalRootFrameWidgetTestHelper() { … }
void WebFrameTestProxy::SynchronouslyCompositeAfterTest(
SynchronouslyCompositeAfterTestCallback callback) { … }
void WebFrameTestProxy::DumpFrameLayout(DumpFrameLayoutCallback callback) { … }
void WebFrameTestProxy::SetTestConfiguration(
mojom::WebTestRunTestConfigurationPtr config,
bool starting_test) { … }
void WebFrameTestProxy::BindReceiver(
mojo::PendingAssociatedReceiver<mojom::WebTestRenderFrame> receiver) { … }
mojom::WebTestControlHost* WebFrameTestProxy::GetWebTestControlHostRemote() { … }
TestRunner* WebFrameTestProxy::test_runner() { … }
void WebFrameTestProxy::SetupRendererProcessForNonTestWindow() { … }
void WebFrameTestProxy::TestFinishedFromSecondaryRenderer() { … }
void WebFrameTestProxy::ProcessWorkItem(mojom::WorkItemPtr work_item) { … }
void WebFrameTestProxy::ReplicateWorkQueueStates(
base::Value::Dict work_queue_states) { … }
void WebFrameTestProxy::ReplicateWebTestRuntimeFlagsChanges(
base::Value::Dict changed_layout_test_runtime_flags) { … }
void WebFrameTestProxy::ResetRendererAfterWebTest() { … }
}