Commit 87d14196 authored by danakj's avatar danakj Committed by Commit Bot

Remove WebTestInterfaces

content/shell/renderer/ can see test_runner::WebTestInterfaces, so it
can also see test_runner::TestInterfaces. The former is just a shallow
wrapper around the latter, so it is not needed at all.

R=avi@chromium.org

Bug: 866140
Change-Id: Ic9ad15d27aae6d0293e23cdfb007e9511ff296d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2128450Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754918}
parent 3362d485
......@@ -47,8 +47,8 @@
#include "content/shell/test_runner/app_banner_service.h"
#include "content/shell/test_runner/gamepad_controller.h"
#include "content/shell/test_runner/pixel_dump.h"
#include "content/shell/test_runner/web_test_interfaces.h"
#include "content/shell/test_runner/web_test_runner.h"
#include "content/shell/test_runner/test_interfaces.h"
#include "content/shell/test_runner/test_runner.h"
#include "content/shell/test_runner/web_widget_test_proxy.h"
#include "ipc/ipc_sync_channel.h"
#include "media/base/audio_capturer_source.h"
......@@ -407,7 +407,7 @@ void BlinkTestRunner::OnWebTestRuntimeFlagsChanged(
// Ignore changes that happen before we got the initial, accumulated
// web flag changes in either OnReplicateTestConfiguration or
// OnSetTestConfiguration.
test_runner::WebTestInterfaces* interfaces =
test_runner::TestInterfaces* interfaces =
WebTestRenderThreadObserver::GetInstance()->test_interfaces();
if (!interfaces->TestIsRunning())
return;
......@@ -416,8 +416,10 @@ void BlinkTestRunner::OnWebTestRuntimeFlagsChanged(
}
void BlinkTestRunner::TestFinished() {
test_runner::WebTestInterfaces* interfaces =
test_runner::TestInterfaces* interfaces =
WebTestRenderThreadObserver::GetInstance()->test_interfaces();
test_runner::TestRunner* test_runner = interfaces->GetTestRunner();
// We might get multiple TestFinished calls, ensure to only process the dump
// once.
if (!interfaces->TestIsRunning())
......@@ -443,9 +445,9 @@ void BlinkTestRunner::TestFinished() {
dump_result_ = mojom::BlinkTestDump::New();
bool browser_should_dump_back_forward_list =
interfaces->TestRunner()->ShouldDumpBackForwardList();
test_runner->ShouldDumpBackForwardList();
if (interfaces->TestRunner()->ShouldDumpAsAudio()) {
if (test_runner->ShouldDumpAsAudio()) {
CaptureLocalAudioDump();
GetWebTestClientRemote()->InitiateCaptureDump(
......@@ -460,14 +462,14 @@ void BlinkTestRunner::TestFinished() {
// rebaselined. But for now, just capture a local web first.
CaptureLocalLayoutDump();
if (!interfaces->TestRunner()->ShouldGeneratePixelResults()) {
if (!test_runner->ShouldGeneratePixelResults()) {
GetWebTestClientRemote()->InitiateCaptureDump(
browser_should_dump_back_forward_list,
/*browser_should_capture_pixels=*/false);
return;
}
if (interfaces->TestRunner()->CanDumpPixelsFromRenderer()) {
if (test_runner->CanDumpPixelsFromRenderer()) {
// This does the capture in the renderer when possible, otherwise
// we will ask the browser to initiate it.
CaptureLocalPixelsDump();
......@@ -476,33 +478,34 @@ void BlinkTestRunner::TestFinished() {
// for layout dump results. Any test can only require the browser to
// dump one or the other at this time.
DCHECK(!waiting_for_layout_dump_results_);
if (interfaces->TestRunner()->ShouldDumpSelectionRect()) {
if (test_runner->ShouldDumpSelectionRect()) {
dump_result_->selection_rect =
web_frame->GetSelectionBoundsRectForTesting();
}
}
GetWebTestClientRemote()->InitiateCaptureDump(
browser_should_dump_back_forward_list,
!interfaces->TestRunner()->CanDumpPixelsFromRenderer());
!test_runner->CanDumpPixelsFromRenderer());
}
void BlinkTestRunner::CaptureLocalAudioDump() {
TRACE_EVENT0("shell", "BlinkTestRunner::CaptureLocalAudioDump");
test_runner::WebTestInterfaces* interfaces =
test_runner::TestInterfaces* interfaces =
WebTestRenderThreadObserver::GetInstance()->test_interfaces();
dump_result_->audio.emplace();
interfaces->TestRunner()->GetAudioData(&*dump_result_->audio);
interfaces->GetTestRunner()->GetAudioData(&*dump_result_->audio);
}
void BlinkTestRunner::CaptureLocalLayoutDump() {
TRACE_EVENT0("shell", "BlinkTestRunner::CaptureLocalLayoutDump");
test_runner::WebTestInterfaces* interfaces =
test_runner::TestInterfaces* interfaces =
WebTestRenderThreadObserver::GetInstance()->test_interfaces();
test_runner::TestRunner* test_runner = interfaces->GetTestRunner();
std::string layout;
if (interfaces->TestRunner()->HasCustomTextDump(&layout)) {
if (test_runner->HasCustomTextDump(&layout)) {
dump_result_->layout.emplace(layout + "\n");
} else if (!interfaces->TestRunner()->IsRecursiveLayoutDumpRequested()) {
dump_result_->layout.emplace(interfaces->TestRunner()->DumpLayout(
} else if (!test_runner->IsRecursiveLayoutDumpRequested()) {
dump_result_->layout.emplace(test_runner->DumpLayout(
render_view()->GetMainRenderFrame()->GetWebFrame()));
} else {
// TODO(vmpstr): Since CaptureDump is called from the browser, we can be
......@@ -521,9 +524,9 @@ void BlinkTestRunner::CaptureLocalPixelsDump() {
waiting_for_pixels_dump_result_ = true;
test_runner::WebTestInterfaces* interfaces =
test_runner::TestInterfaces* interfaces =
WebTestRenderThreadObserver::GetInstance()->test_interfaces();
interfaces->TestRunner()->DumpPixelsAsync(
interfaces->GetTestRunner()->DumpPixelsAsync(
render_view(), base::BindOnce(&BlinkTestRunner::OnPixelsDumpCompleted,
base::Unretained(this)));
}
......@@ -771,7 +774,7 @@ void BlinkTestRunner::OnSetupSecondaryRenderer() {
// |!is_main_window_|.
is_secondary_window_ = true;
test_runner::WebTestInterfaces* interfaces =
test_runner::TestInterfaces* interfaces =
WebTestRenderThreadObserver::GetInstance()->test_interfaces();
interfaces->SetTestIsRunning(true);
ForceResizeRenderView(render_view(), WebSize(800, 600));
......@@ -779,7 +782,7 @@ void BlinkTestRunner::OnSetupSecondaryRenderer() {
void BlinkTestRunner::ApplyTestConfiguration(
mojom::ShellTestConfigurationPtr params) {
test_runner::WebTestInterfaces* interfaces =
test_runner::TestInterfaces* interfaces =
WebTestRenderThreadObserver::GetInstance()->test_interfaces();
test_config_ = params.Clone();
......@@ -805,10 +808,10 @@ void BlinkTestRunner::OnSetTestConfiguration(
WebSize(local_params->initial_size.width(),
local_params->initial_size.height()));
WebTestRenderThreadObserver::GetInstance()
->test_interfaces()
->TestRunner()
->SetFocus(render_view()->GetWebView(), true);
test_runner::TestInterfaces* interfaces =
WebTestRenderThreadObserver::GetInstance()->test_interfaces();
test_runner::TestRunner* test_runner = interfaces->GetTestRunner();
test_runner->SetFocus(render_view()->GetWebView(), true);
}
void BlinkTestRunner::OnReset() {
......@@ -836,7 +839,7 @@ void BlinkTestRunner::OnTestFinishedInSecondaryRenderer() {
// Avoid a situation where TestFinished is called twice, because
// of a racey test finish in 2 secondary renderers.
test_runner::WebTestInterfaces* interfaces =
test_runner::TestInterfaces* interfaces =
WebTestRenderThreadObserver::GetInstance()->test_interfaces();
if (!interfaces->TestIsRunning())
return;
......
......@@ -27,7 +27,6 @@
#include "content/shell/renderer/web_test/web_test_render_frame_observer.h"
#include "content/shell/renderer/web_test/web_test_render_thread_observer.h"
#include "content/shell/test_runner/web_frame_test_proxy.h"
#include "content/shell/test_runner/web_test_interfaces.h"
#include "content/shell/test_runner/web_test_runner.h"
#include "media/base/audio_latency.h"
#include "media/base/mime_util.h"
......
......@@ -11,8 +11,8 @@
#include "content/public/renderer/render_view.h"
#include "content/shell/renderer/web_test/blink_test_runner.h"
#include "content/shell/renderer/web_test/web_test_render_thread_observer.h"
#include "content/shell/test_runner/web_test_interfaces.h"
#include "content/shell/test_runner/web_test_runner.h"
#include "content/shell/test_runner/test_interfaces.h"
#include "content/shell/test_runner/test_runner.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/public/web/web_frame_widget.h"
......@@ -25,10 +25,10 @@ namespace content {
WebTestRenderFrameObserver::WebTestRenderFrameObserver(
RenderFrame* render_frame)
: RenderFrameObserver(render_frame) {
test_runner::WebTestRunner* test_runner =
test_runner::TestRunner* test_runner =
WebTestRenderThreadObserver::GetInstance()
->test_interfaces()
->TestRunner();
->GetTestRunner();
render_frame->GetWebFrame()->SetContentSettingsClient(
test_runner->GetWebContentSettings());
render_frame->GetWebFrame()->SetTextCheckClient(
......@@ -78,11 +78,11 @@ void WebTestRenderFrameObserver::CompositeWithRaster(
void WebTestRenderFrameObserver::DumpFrameLayout(
DumpFrameLayoutCallback callback) {
std::string dump = WebTestRenderThreadObserver::GetInstance()
->test_interfaces()
->TestRunner()
->DumpLayout(render_frame()->GetWebFrame());
std::move(callback).Run(dump);
test_runner::TestInterfaces* interfaces =
WebTestRenderThreadObserver::GetInstance()->test_interfaces();
test_runner::TestRunner* test_runner = interfaces->GetTestRunner();
std::string dump = test_runner->DumpLayout(render_frame()->GetWebFrame());
std::move(callback).Run(std::move(dump));
}
void WebTestRenderFrameObserver::ReplicateTestConfiguration(
......
......@@ -9,9 +9,9 @@
#include "content/public/test/web_test_support.h"
#include "content/shell/common/web_test/web_test_switches.h"
#include "content/shell/test_runner/test_interfaces.h"
#include "content/shell/test_runner/web_test_interfaces.h"
#include "content/shell/test_runner/web_test_runner.h"
#include "content/shell/test_runner/test_runner.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/web/blink.h"
namespace content {
......@@ -28,9 +28,11 @@ WebTestRenderThreadObserver::WebTestRenderThreadObserver() {
CHECK(!g_instance);
g_instance = this;
RenderThread::Get()->AddObserver(this);
EnableRendererWebTestMode();
blink::SetWebTestMode(true);
test_interfaces_.reset(new test_runner::WebTestInterfaces);
test_interfaces_ = std::make_unique<test_runner::TestInterfaces>();
test_interfaces_->ResetAll();
}
......@@ -63,7 +65,7 @@ void WebTestRenderThreadObserver::ReplicateWebTestRuntimeFlagsChanges(
bool ok = changed_layout_test_runtime_flags.GetAsDictionary(
&changed_web_test_runtime_flags_dictionary);
DCHECK(ok);
test_interfaces()->TestRunner()->ReplicateWebTestRuntimeFlagsChanges(
test_interfaces()->GetTestRunner()->ReplicateWebTestRuntimeFlagsChanges(
*changed_web_test_runtime_flags_dictionary);
}
......
......@@ -14,7 +14,7 @@
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
namespace test_runner {
class WebTestInterfaces;
class TestInterfaces;
}
namespace content {
......@@ -27,7 +27,7 @@ class WebTestRenderThreadObserver : public RenderThreadObserver,
WebTestRenderThreadObserver();
~WebTestRenderThreadObserver() override;
test_runner::WebTestInterfaces* test_interfaces() const {
test_runner::TestInterfaces* test_interfaces() const {
return test_interfaces_.get();
}
......@@ -37,14 +37,16 @@ class WebTestRenderThreadObserver : public RenderThreadObserver,
void UnregisterMojoInterfaces(
blink::AssociatedInterfaceRegistry* associated_interfaces) override;
private:
// mojom::WebTestControl implementation.
void ReplicateWebTestRuntimeFlagsChanges(
base::Value changed_layout_test_runtime_flags) override;
private:
// Helper to bind this class as the mojom::WebTestControl.
void OnWebTestControlAssociatedRequest(
mojo::PendingAssociatedReceiver<mojom::WebTestControl> receiver);
std::unique_ptr<test_runner::WebTestInterfaces> test_interfaces_;
std::unique_ptr<test_runner::TestInterfaces> test_interfaces_;
mojo::AssociatedReceiver<mojom::WebTestControl> receiver_{this};
......
......@@ -69,8 +69,6 @@ jumbo_component("test_runner") {
"web_frame_test_proxy.cc",
"web_frame_test_proxy.h",
"web_test_delegate.h",
"web_test_interfaces.cc",
"web_test_interfaces.h",
"web_test_runner.h",
"web_test_runtime_flags.cc",
"web_test_runtime_flags.h",
......
......@@ -27,10 +27,7 @@ namespace test_runner {
TestInterfaces::TestInterfaces()
: gamepad_controller_(new GamepadController()),
test_runner_(new TestRunner(this)),
delegate_(nullptr),
main_view_(nullptr) {
blink::SetWebTestMode(true);
test_runner_(new TestRunner(this)) {
// NOTE: please don't put feature specific enable flags here,
// instead add them to runtime_enabled_features.json5
}
......
......@@ -10,6 +10,7 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "content/shell/test_runner/test_runner_export.h"
namespace blink {
class WebLocalFrame;
......@@ -18,13 +19,12 @@ class WebView;
}
namespace test_runner {
class GamepadController;
class TestRunner;
class WebTestDelegate;
class WebViewTestProxy;
class TestInterfaces {
class TEST_RUNNER_EXPORT TestInterfaces {
public:
TestInterfaces();
~TestInterfaces();
......@@ -56,10 +56,10 @@ class TestInterfaces {
std::unique_ptr<GamepadController> gamepad_controller_;
std::unique_ptr<TestRunner> test_runner_;
WebTestDelegate* delegate_;
WebTestDelegate* delegate_ = nullptr;
std::vector<WebViewTestProxy*> window_list_;
blink::WebView* main_view_;
blink::WebView* main_view_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(TestInterfaces);
};
......
......@@ -10,7 +10,6 @@
#include "content/shell/test_runner/test_runner.h"
#include "content/shell/test_runner/web_frame_test_client.h"
#include "content/shell/test_runner/web_test_delegate.h"
#include "content/shell/test_runner/web_test_interfaces.h"
#include "content/shell/test_runner/web_view_test_proxy.h"
#include "third_party/blink/public/web/web_local_frame.h"
......@@ -120,14 +119,16 @@ class TestRenderFrameObserver : public content::RenderFrameObserver {
WebFrameTestProxy::~WebFrameTestProxy() = default;
void WebFrameTestProxy::Initialize(
WebTestInterfaces* interfaces,
content::RenderViewImpl* render_view_for_frame) {
// The RenderViewImpl will also be a test proxy type.
auto* view_proxy_for_frame =
static_cast<WebViewTestProxy*>(render_view_for_frame);
// Creates a WebLocalFrameClient implementation providing test behavior (i.e.
// forwarding javascript console output to the test harness).
test_client_ =
interfaces->CreateWebFrameTestClient(view_proxy_for_frame, this);
std::make_unique<WebFrameTestClient>(view_proxy_for_frame, this);
new TestRenderFrameObserver(this, view_proxy_for_frame); // deletes itself.
}
......
......@@ -23,7 +23,6 @@ class RenderViewImpl;
} // namespace content
namespace test_runner {
class WebTestInterfaces;
// WebFrameTestProxy is used during running web tests instead of a
// RenderFrameImpl to inject test-only behaviour by overriding methods in the
......@@ -35,8 +34,7 @@ class TEST_RUNNER_EXPORT WebFrameTestProxy : public content::RenderFrameImpl {
: RenderFrameImpl(std::forward<Args>(args)...) {}
~WebFrameTestProxy() override;
void Initialize(WebTestInterfaces* interfaces,
content::RenderViewImpl* render_view_for_frame);
void Initialize(content::RenderViewImpl* render_view_for_frame);
// Returns a frame name that can be used in the output of web tests
// (the name is derived from the frame's unique name).
......
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/shell/test_runner/web_test_interfaces.h"
#include <utility>
#include "content/shell/test_runner/test_interfaces.h"
#include "content/shell/test_runner/test_runner.h"
#include "content/shell/test_runner/web_frame_test_client.h"
#include "content/shell/test_runner/web_view_test_proxy.h"
#include "content/shell/test_runner/web_widget_test_proxy.h"
namespace test_runner {
WebTestInterfaces::WebTestInterfaces() : interfaces_(new TestInterfaces()) {}
WebTestInterfaces::~WebTestInterfaces() {}
void WebTestInterfaces::SetMainView(blink::WebView* web_view) {
interfaces_->SetMainView(web_view);
}
void WebTestInterfaces::SetDelegate(WebTestDelegate* delegate) {
interfaces_->SetDelegate(delegate);
}
bool WebTestInterfaces::HasDelegate() {
return interfaces_->GetDelegate();
}
void WebTestInterfaces::ResetAll() {
interfaces_->ResetAll();
}
bool WebTestInterfaces::TestIsRunning() {
return interfaces_->TestIsRunning();
}
void WebTestInterfaces::SetTestIsRunning(bool running) {
interfaces_->SetTestIsRunning(running);
}
void WebTestInterfaces::ConfigureForTestWithURL(const blink::WebURL& test_url,
bool protocol_mode) {
interfaces_->ConfigureForTestWithURL(test_url, protocol_mode);
}
WebTestRunner* WebTestInterfaces::TestRunner() {
return interfaces_->GetTestRunner();
}
TestInterfaces* WebTestInterfaces::GetTestInterfaces() {
return interfaces_.get();
}
std::unique_ptr<WebFrameTestClient> WebTestInterfaces::CreateWebFrameTestClient(
WebViewTestProxy* web_view_test_proxy,
WebFrameTestProxy* web_frame_test_proxy) {
return std::make_unique<WebFrameTestClient>(web_view_test_proxy,
web_frame_test_proxy);
}
std::vector<blink::WebView*> WebTestInterfaces::GetWindowList() {
std::vector<blink::WebView*> result;
for (WebViewTestProxy* proxy : interfaces_->GetWindowList())
result.push_back(proxy->GetWebView());
return result;
}
} // namespace test_runner
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_SHELL_TEST_RUNNER_WEB_TEST_INTERFACES_H_
#define CONTENT_SHELL_TEST_RUNNER_WEB_TEST_INTERFACES_H_
#include <memory>
#include <vector>
#include "base/macros.h"
#include "content/shell/test_runner/test_runner_export.h"
namespace blink {
class WebLocalFrameClient;
class WebRTCPeerConnectionHandler;
class WebRTCPeerConnectionHandlerClient;
class WebURL;
class WebView;
}
namespace test_runner {
class TestInterfaces;
class WebFrameTestClient;
class WebFrameTestProxy;
class WebTestDelegate;
class WebViewTestProxy;
class WebTestRunner;
class TEST_RUNNER_EXPORT WebTestInterfaces {
public:
WebTestInterfaces();
~WebTestInterfaces();
void SetMainView(blink::WebView* web_view);
void SetDelegate(WebTestDelegate* delegate);
bool HasDelegate();
void ResetAll();
bool TestIsRunning();
void SetTestIsRunning(bool running);
// Configures the renderer for the test, based on |test_url| and
// |procotol_mode|.
void ConfigureForTestWithURL(const blink::WebURL& test_url,
bool protocol_mode);
WebTestRunner* TestRunner();
std::unique_ptr<blink::WebRTCPeerConnectionHandler>
CreateWebRTCPeerConnectionHandler(
blink::WebRTCPeerConnectionHandlerClient* client);
TestInterfaces* GetTestInterfaces();
// Creates a WebLocalFrameClient implementation providing test behavior (i.e.
// forwarding javascript console output to the test harness). The caller
// should guarantee that the returned object won't be used beyond the lifetime
// of WebTestInterfaces and/or the lifetime of |web_view_test_proxy|.
std::unique_ptr<WebFrameTestClient> CreateWebFrameTestClient(
WebViewTestProxy* web_view_test_proxy,
WebFrameTestProxy* web_frame_test_proxy);
// Gets a list of currently opened windows created by the current test.
std::vector<blink::WebView*> GetWindowList();
private:
std::unique_ptr<TestInterfaces> interfaces_;
DISALLOW_COPY_AND_ASSIGN(WebTestInterfaces);
};
} // namespace test_runner
#endif // CONTENT_SHELL_TEST_RUNNER_WEB_TEST_INTERFACES_H_
......@@ -12,7 +12,6 @@
#include "content/shell/test_runner/test_interfaces.h"
#include "content/shell/test_runner/test_runner.h"
#include "content/shell/test_runner/web_test_delegate.h"
#include "content/shell/test_runner/web_test_interfaces.h"
#include "content/shell/test_runner/web_widget_test_proxy.h"
#include "third_party/blink/public/platform/web_url_request.h"
#include "third_party/blink/public/web/web_frame.h"
......@@ -22,10 +21,10 @@
namespace test_runner {
void WebViewTestProxy::Initialize(WebTestInterfaces* interfaces,
void WebViewTestProxy::Initialize(TestInterfaces* interfaces,
std::unique_ptr<WebTestDelegate> delegate) {
delegate_ = std::move(delegate);
test_interfaces_ = interfaces->GetTestInterfaces();
test_interfaces_ = interfaces;
test_interfaces()->WindowOpened(this);
}
......
......@@ -41,7 +41,6 @@ class TestInterfaces;
class TestRunnerForSpecificView;
class TextInputController;
class WebTestDelegate;
class WebTestInterfaces;
// WebViewTestProxy is used to run web tests. This class is a partial fake
// implementation of RenderViewImpl that overrides the minimal necessary
......@@ -65,7 +64,7 @@ class TEST_RUNNER_EXPORT WebViewTestProxy : public content::RenderViewImpl {
template <typename... Args>
explicit WebViewTestProxy(Args&&... args)
: RenderViewImpl(std::forward<Args>(args)...) {}
void Initialize(WebTestInterfaces* interfaces,
void Initialize(TestInterfaces* interfaces,
std::unique_ptr<WebTestDelegate> delegate);
// WebViewClient implementation.
......
......@@ -10,7 +10,6 @@
#include "content/shell/test_runner/test_runner.h"
#include "content/shell/test_runner/test_runner_for_specific_view.h"
#include "content/shell/test_runner/web_test_delegate.h"
#include "content/shell/test_runner/web_test_interfaces.h"
#include "content/shell/test_runner/web_view_test_proxy.h"
#include "third_party/blink/public/web/web_frame_widget.h"
#include "third_party/blink/public/web/web_local_frame.h"
......
......@@ -24,8 +24,8 @@
#include "content/renderer/render_widget.h"
#include "content/shell/renderer/web_test/blink_test_runner.h"
#include "content/shell/renderer/web_test/web_test_render_thread_observer.h"
#include "content/shell/test_runner/test_interfaces.h"
#include "content/shell/test_runner/web_frame_test_proxy.h"
#include "content/shell/test_runner/web_test_interfaces.h"
#include "content/shell/test_runner/web_view_test_proxy.h"
#include "content/shell/test_runner/web_widget_test_proxy.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
......@@ -56,22 +56,22 @@ namespace {
RenderViewImpl* CreateWebViewTestProxy(CompositorDependencies* compositor_deps,
const mojom::CreateViewParams& params) {
test_runner::WebTestInterfaces* interfaces =
test_runner::TestInterfaces* interfaces =
WebTestRenderThreadObserver::GetInstance()->test_interfaces();
auto* render_view_proxy =
new test_runner::WebViewTestProxy(compositor_deps, params);
auto test_runner = std::make_unique<BlinkTestRunner>(render_view_proxy);
auto blink_test_runner = std::make_unique<BlinkTestRunner>(render_view_proxy);
// TODO(lukasza): Using the first BlinkTestRunner as the main delegate is
// wrong, but it is difficult to change because this behavior has been baked
// for a long time into test assumptions (i.e. which PrintMessage gets
// delivered to the browser depends on this).
if (!interfaces->HasDelegate()) {
interfaces->SetDelegate(test_runner.get());
if (!interfaces->GetDelegate()) {
interfaces->SetDelegate(blink_test_runner.get());
}
render_view_proxy->Initialize(interfaces, std::move(test_runner));
render_view_proxy->Initialize(interfaces, std::move(blink_test_runner));
return render_view_proxy;
}
......@@ -87,15 +87,12 @@ std::unique_ptr<RenderWidget> CreateRenderWidgetForFrame(
}
RenderFrameImpl* CreateWebFrameTestProxy(RenderFrameImpl::CreateParams params) {
test_runner::WebTestInterfaces* interfaces =
WebTestRenderThreadObserver::GetInstance()->test_interfaces();
// RenderFrameImpl always has a RenderViewImpl for it.
RenderViewImpl* render_view_impl = params.render_view;
auto* render_frame_proxy =
new test_runner::WebFrameTestProxy(std::move(params));
render_frame_proxy->Initialize(interfaces, render_view_impl);
render_frame_proxy->Initialize(render_view_impl);
return render_frame_proxy;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment