Commit 4184bbb0 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

Convert browser side's legacy IPCs of BlinkTest message to Mojo

As a step to convert legacy IPCs to the Mojo, this CL
converts browser side's BlinkTest IPCs to Mojo. This
CL introduces WebTestClient interface to replace the
IPC messages to Mojo methods in web_test.mojom file.
The interface starts to support the original messages
as below,

 - InitiateLayoutDump()
 - PrintMessageToStderr()
 - SetPopupBlockingEnabled()
 - NavigateSecondaryWindow()
 - GoToOffset
 - Reload()
 - LoadURLForFrame()
 - CloseRemainingWindows()
 - ResetDone()
 - SendBluetoothManualChooserEvent()
 - GetBluetoothManualChooserEvents()
 - SetBluetoothManualChooser()

This CL should not change any behavior.

Bug: 1039247
Change-Id: Ic30f8cc0cb19ec8a306b577f3c10567d91bdccf1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2002047Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#732388}
parent 293fc10a
...@@ -170,6 +170,8 @@ jumbo_static_library("content_shell_lib") { ...@@ -170,6 +170,8 @@ jumbo_static_library("content_shell_lib") {
"browser/web_test/test_info_extractor.h", "browser/web_test/test_info_extractor.h",
"browser/web_test/web_test_background_fetch_delegate.cc", "browser/web_test/web_test_background_fetch_delegate.cc",
"browser/web_test/web_test_background_fetch_delegate.h", "browser/web_test/web_test_background_fetch_delegate.h",
"browser/web_test/web_test_blink_test_client.cc",
"browser/web_test/web_test_blink_test_client.h",
"browser/web_test/web_test_bluetooth_adapter_provider.cc", "browser/web_test/web_test_bluetooth_adapter_provider.cc",
"browser/web_test/web_test_bluetooth_adapter_provider.h", "browser/web_test/web_test_bluetooth_adapter_provider.h",
"browser/web_test/web_test_bluetooth_chooser_factory.cc", "browser/web_test/web_test_bluetooth_chooser_factory.cc",
......
...@@ -803,28 +803,8 @@ bool BlinkTestController::OnMessageReceived(const IPC::Message& message) { ...@@ -803,28 +803,8 @@ bool BlinkTestController::OnMessageReceived(const IPC::Message& message) {
bool handled = true; bool handled = true;
IPC_BEGIN_MESSAGE_MAP(BlinkTestController, message) IPC_BEGIN_MESSAGE_MAP(BlinkTestController, message)
IPC_MESSAGE_HANDLER(BlinkTestHostMsg_PrintMessage, OnPrintMessage) IPC_MESSAGE_HANDLER(BlinkTestHostMsg_PrintMessage, OnPrintMessage)
IPC_MESSAGE_HANDLER(BlinkTestHostMsg_PrintMessageToStderr,
OnPrintMessageToStderr)
IPC_MESSAGE_HANDLER(BlinkTestHostMsg_InitiateLayoutDump,
OnInitiateLayoutDump)
IPC_MESSAGE_HANDLER(BlinkTestHostMsg_OverridePreferences, IPC_MESSAGE_HANDLER(BlinkTestHostMsg_OverridePreferences,
OnOverridePreferences) OnOverridePreferences)
IPC_MESSAGE_HANDLER(BlinkTestHostMsg_SetPopupBlockingEnabled,
OnSetPopupBlockingEnabled)
IPC_MESSAGE_HANDLER(BlinkTestHostMsg_NavigateSecondaryWindow,
OnNavigateSecondaryWindow)
IPC_MESSAGE_HANDLER(BlinkTestHostMsg_GoToOffset, OnGoToOffset)
IPC_MESSAGE_HANDLER(BlinkTestHostMsg_Reload, OnReload)
IPC_MESSAGE_HANDLER(BlinkTestHostMsg_LoadURLForFrame, OnLoadURLForFrame)
IPC_MESSAGE_HANDLER(BlinkTestHostMsg_CloseRemainingWindows,
OnCloseRemainingWindows)
IPC_MESSAGE_HANDLER(BlinkTestHostMsg_ResetDone, OnResetDone)
IPC_MESSAGE_HANDLER(BlinkTestHostMsg_SetBluetoothManualChooser,
OnSetBluetoothManualChooser)
IPC_MESSAGE_HANDLER(BlinkTestHostMsg_GetBluetoothManualChooserEvents,
OnGetBluetoothManualChooserEvents)
IPC_MESSAGE_HANDLER(BlinkTestHostMsg_SendBluetoothManualChooserEvent,
OnSendBluetoothManualChooserEvent)
IPC_MESSAGE_HANDLER(WebTestHostMsg_BlockThirdPartyCookies, IPC_MESSAGE_HANDLER(WebTestHostMsg_BlockThirdPartyCookies,
OnBlockThirdPartyCookies) OnBlockThirdPartyCookies)
IPC_MESSAGE_UNHANDLED(handled = false) IPC_MESSAGE_UNHANDLED(handled = false)
......
...@@ -184,6 +184,20 @@ class BlinkTestController : public WebContentsObserver, ...@@ -184,6 +184,20 @@ class BlinkTestController : public WebContentsObserver,
return accumulated_web_test_runtime_flags_changes_; return accumulated_web_test_runtime_flags_changes_;
} }
void OnInitiateLayoutDump();
void OnResetDone();
void OnPrintMessageToStderr(const std::string& message);
void OnReload();
void OnCloseRemainingWindows();
void OnGoToOffset(int offset);
void OnSetBluetoothManualChooser(bool enable);
void OnGetBluetoothManualChooserEvents();
void OnSendBluetoothManualChooserEvent(const std::string& event,
const std::string& argument);
void OnSetPopupBlockingEnabled(bool block_popups);
void OnLoadURLForFrame(const GURL& url, const std::string& frame_name);
void OnNavigateSecondaryWindow(const GURL& url);
private: private:
enum TestPhase { BETWEEN_TESTS, DURING_TEST, CLEAN_UP }; enum TestPhase { BETWEEN_TESTS, DURING_TEST, CLEAN_UP };
...@@ -211,26 +225,13 @@ class BlinkTestController : public WebContentsObserver, ...@@ -211,26 +225,13 @@ class BlinkTestController : public WebContentsObserver,
void OnAudioDump(const std::vector<unsigned char>& audio_dump); void OnAudioDump(const std::vector<unsigned char>& audio_dump);
void OnImageDump(const std::string& actual_pixel_hash, const SkBitmap& image); void OnImageDump(const std::string& actual_pixel_hash, const SkBitmap& image);
void OnTextDump(const std::string& dump); void OnTextDump(const std::string& dump);
void OnInitiateLayoutDump();
void OnDumpFrameLayoutResponse(int frame_tree_node_id, void OnDumpFrameLayoutResponse(int frame_tree_node_id,
const std::string& dump); const std::string& dump);
void OnPrintMessageToStderr(const std::string& message);
void OnPrintMessage(const std::string& message); void OnPrintMessage(const std::string& message);
void OnOverridePreferences(const WebPreferences& prefs); void OnOverridePreferences(const WebPreferences& prefs);
void OnSetPopupBlockingEnabled(bool block_popups);
void OnTestFinished(); void OnTestFinished();
void OnNavigateSecondaryWindow(const GURL& url);
void OnGoToOffset(int offset);
void OnReload();
void OnLoadURLForFrame(const GURL& url, const std::string& frame_name);
void OnCaptureSessionHistory(); void OnCaptureSessionHistory();
void OnCloseRemainingWindows();
void OnResetDone();
void OnLeakDetectionDone(const LeakDetector::LeakDetectionReport& report); void OnLeakDetectionDone(const LeakDetector::LeakDetectionReport& report);
void OnSetBluetoothManualChooser(bool enable);
void OnGetBluetoothManualChooserEvents();
void OnSendBluetoothManualChooserEvent(const std::string& event,
const std::string& argument);
void OnBlockThirdPartyCookies(bool block); void OnBlockThirdPartyCookies(bool block);
mojo::AssociatedRemote<mojom::WebTestControl>& GetWebTestControlRemote( mojo::AssociatedRemote<mojom::WebTestControl>& GetWebTestControlRemote(
RenderFrameHost* frame); RenderFrameHost* frame);
......
// Copyright 2020 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/browser/web_test/web_test_blink_test_client.h"
#include <memory>
#include <string>
#include <utility>
#include "content/shell/browser/web_test/blink_test_controller.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
namespace content {
WebTestBlinkTestClient::WebTestBlinkTestClient() {}
WebTestBlinkTestClient::~WebTestBlinkTestClient() {}
// static
void WebTestBlinkTestClient::Create(
mojo::PendingReceiver<mojom::WebTestClient> receiver) {
mojo::MakeSelfOwnedReceiver(std::make_unique<WebTestBlinkTestClient>(),
std::move(receiver));
}
void WebTestBlinkTestClient::InitiateLayoutDump() {
BlinkTestController::Get()->OnInitiateLayoutDump();
}
void WebTestBlinkTestClient::ResetDone() {
BlinkTestController::Get()->OnResetDone();
}
void WebTestBlinkTestClient::PrintMessageToStderr(const std::string& message) {
BlinkTestController::Get()->OnPrintMessageToStderr(message);
}
void WebTestBlinkTestClient::Reload() {
BlinkTestController::Get()->OnReload();
}
void WebTestBlinkTestClient::CloseRemainingWindows() {
BlinkTestController::Get()->OnCloseRemainingWindows();
}
void WebTestBlinkTestClient::GoToOffset(int offset) {
BlinkTestController::Get()->OnGoToOffset(offset);
}
void WebTestBlinkTestClient::SendBluetoothManualChooserEvent(
const std::string& event,
const std::string& argument) {
BlinkTestController::Get()->OnSendBluetoothManualChooserEvent(event,
argument);
}
void WebTestBlinkTestClient::SetBluetoothManualChooser(bool enable) {
BlinkTestController::Get()->OnSetBluetoothManualChooser(enable);
}
void WebTestBlinkTestClient::GetBluetoothManualChooserEvents() {
BlinkTestController::Get()->OnGetBluetoothManualChooserEvents();
}
void WebTestBlinkTestClient::SetPopupBlockingEnabled(bool block_popups) {
BlinkTestController::Get()->OnSetPopupBlockingEnabled(block_popups);
}
void WebTestBlinkTestClient::LoadURLForFrame(const GURL& url,
const std::string& frame_name) {
BlinkTestController::Get()->OnLoadURLForFrame(url, frame_name);
}
void WebTestBlinkTestClient::NavigateSecondaryWindow(const GURL& url) {
BlinkTestController::Get()->OnNavigateSecondaryWindow(url);
}
} // namespace content
// Copyright 2020 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_BROWSER_WEB_TEST_WEB_TEST_BLINK_TEST_CLIENT_H_
#define CONTENT_SHELL_BROWSER_WEB_TEST_WEB_TEST_BLINK_TEST_CLIENT_H_
#include "base/macros.h"
#include "content/shell/common/web_test.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "url/gurl.h"
namespace content {
class WebTestBlinkTestClient : public mojom::WebTestClient {
public:
WebTestBlinkTestClient();
~WebTestBlinkTestClient() override;
static void Create(mojo::PendingReceiver<mojom::WebTestClient> receiver);
private:
// WebTestClient implementation.
void InitiateLayoutDump() override;
void ResetDone() override;
void PrintMessageToStderr(const std::string& message) override;
void Reload() override;
void CloseRemainingWindows() override;
void GoToOffset(int offset) override;
void SendBluetoothManualChooserEvent(const std::string& event,
const std::string& argument) override;
void SetBluetoothManualChooser(bool enable) override;
void GetBluetoothManualChooserEvents() override;
void SetPopupBlockingEnabled(bool block_popups) override;
void LoadURLForFrame(const GURL& url, const std::string& frame_name) override;
void NavigateSecondaryWindow(const GURL& url) override;
DISALLOW_COPY_AND_ASSIGN(WebTestBlinkTestClient);
};
} // namespace content
#endif // CONTENT_SHELL_BROWSER_WEB_TEST_WEB_TEST_BLINK_TEST_CLIENT_H_
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "content/shell/browser/web_test/fake_bluetooth_chooser.h" #include "content/shell/browser/web_test/fake_bluetooth_chooser.h"
#include "content/shell/browser/web_test/fake_bluetooth_chooser_factory.h" #include "content/shell/browser/web_test/fake_bluetooth_chooser_factory.h"
#include "content/shell/browser/web_test/mojo_web_test_helper.h" #include "content/shell/browser/web_test/mojo_web_test_helper.h"
#include "content/shell/browser/web_test/web_test_blink_test_client.h"
#include "content/shell/browser/web_test/web_test_bluetooth_fake_adapter_setter_impl.h" #include "content/shell/browser/web_test/web_test_bluetooth_fake_adapter_setter_impl.h"
#include "content/shell/browser/web_test/web_test_browser_context.h" #include "content/shell/browser/web_test/web_test_browser_context.h"
#include "content/shell/browser/web_test/web_test_browser_main_parts.h" #include "content/shell/browser/web_test/web_test_browser_main_parts.h"
...@@ -156,6 +157,9 @@ void WebTestContentBrowserClient::ExposeInterfacesToRenderer( ...@@ -156,6 +157,9 @@ void WebTestContentBrowserClient::ExposeInterfacesToRenderer(
base::BindRepeating(&WebTestBluetoothFakeAdapterSetterImpl::Create), base::BindRepeating(&WebTestBluetoothFakeAdapterSetterImpl::Create),
ui_task_runner); ui_task_runner);
registry->AddInterface(base::BindRepeating(&WebTestBlinkTestClient::Create),
ui_task_runner);
registry->AddInterface(base::BindRepeating(&bluetooth::FakeBluetooth::Create), registry->AddInterface(base::BindRepeating(&bluetooth::FakeBluetooth::Create),
ui_task_runner); ui_task_runner);
// This class outlives |render_process_host|, which owns |registry|. Since // This class outlives |render_process_host|, which owns |registry|. Since
......
...@@ -49,6 +49,7 @@ struct WebTestDump { ...@@ -49,6 +49,7 @@ struct WebTestDump {
gfx.mojom.Rect selection_rect; gfx.mojom.Rect selection_rect;
}; };
// Blink test messages sent from the browser process to the renderer.
interface WebTestControl { interface WebTestControl {
CaptureDump() => (WebTestDump result); CaptureDump() => (WebTestDump result);
...@@ -85,3 +86,52 @@ interface WebTestControl { ...@@ -85,3 +86,52 @@ interface WebTestControl {
// Reply Bluetooth manual events to BlinkTestRunner. // Reply Bluetooth manual events to BlinkTestRunner.
ReplyBluetoothManualChooserEvents(array<string> events); ReplyBluetoothManualChooserEvents(array<string> events);
}; };
// Blink test messages sent from the renderer process to the browser.
interface WebTestClient {
// Asks the browser process to perform a layout dump spanning all the
// (potentially cross-process) frames. This goes through multiple
// WebTestControl.DumpFrameLayout calls and ends with sending of
// BlinkTestMsg_LayoutDumpCompleted.
InitiateLayoutDump();
// Notify the browser process the reset was done.
ResetDone();
// Add a message to stderr (not saved to expected output files, for debugging
// only).
PrintMessageToStderr(string message);
// Trigger a reload navigation on the main WebView.
Reload();
// Invoked when the embedder should close all but the main WebView.
CloseRemainingWindows();
// Trigger a GoToOffset navigation on the main WebView.
GoToOffset(int32 offset);
// Calls the BluetoothChooser::EventHandler with the arguments here. Valid
// event strings are:
// * "cancel" - simulates the user canceling the chooser.
// * "select" - simulates the user selecting a device whose device ID is in
// |argument|.
SendBluetoothManualChooserEvent(string event, string argument);
// If |enable| is true makes the Bluetooth chooser record its input and wait
// for instructions from the test program on how to proceed. Otherwise
// fall backs to the browser's default chooser.
SetBluetoothManualChooser(bool enable);
// Returns the events recorded since the last call to this function.
GetBluetoothManualChooserEvents();
// Manages the popup blocking setting to used for web tests.
SetPopupBlockingEnabled(bool block_popups);
// Trigger a loadURL navigation on the main WebView.
LoadURLForFrame(url.mojom.Url url, string frame_name);
// Naivgate a URL on the secondary window.
NavigateSecondaryWindow(url.mojom.Url url);
};
...@@ -15,37 +15,9 @@ ...@@ -15,37 +15,9 @@
#define IPC_MESSAGE_START BlinkTestMsgStart #define IPC_MESSAGE_START BlinkTestMsgStart
// Asks the browser process to perform a layout dump spanning all the
// (potentially cross-process) frames. This goes through multiple
// WebTestControl.DumpFrameLayout calls and ends with sending of
// LayoutDumpCompleted.
// TODO(crbug.com/1039247): LayoutDumpCompleted call should be removed and the
// callback should happen part of LayoutDump call on the host interface.
IPC_MESSAGE_ROUTED0(BlinkTestHostMsg_InitiateLayoutDump)
IPC_MESSAGE_ROUTED0(BlinkTestHostMsg_ResetDone)
// WebTestDelegate related. // WebTestDelegate related.
IPC_MESSAGE_ROUTED1(BlinkTestHostMsg_OverridePreferences, IPC_MESSAGE_ROUTED1(BlinkTestHostMsg_OverridePreferences,
content::WebPreferences /* preferences */) content::WebPreferences /* preferences */)
IPC_MESSAGE_ROUTED1(BlinkTestHostMsg_PrintMessage, std::string /* message */) IPC_MESSAGE_ROUTED1(BlinkTestHostMsg_PrintMessage, std::string /* message */)
IPC_MESSAGE_ROUTED1(BlinkTestHostMsg_PrintMessageToStderr,
std::string /* message */)
IPC_MESSAGE_ROUTED1(BlinkTestHostMsg_NavigateSecondaryWindow, GURL /* url */)
IPC_MESSAGE_ROUTED1(BlinkTestHostMsg_GoToOffset, int /* offset */)
IPC_MESSAGE_ROUTED0(BlinkTestHostMsg_Reload)
IPC_MESSAGE_ROUTED2(BlinkTestHostMsg_LoadURLForFrame,
GURL /* url */,
std::string /* frame_name */)
IPC_MESSAGE_ROUTED0(BlinkTestHostMsg_CloseRemainingWindows)
IPC_MESSAGE_ROUTED1(BlinkTestHostMsg_SetBluetoothManualChooser,
bool /* enable */)
IPC_MESSAGE_ROUTED0(BlinkTestHostMsg_GetBluetoothManualChooserEvents)
IPC_MESSAGE_ROUTED2(BlinkTestHostMsg_SendBluetoothManualChooserEvent,
std::string /* event */,
std::string /* argument */)
IPC_MESSAGE_ROUTED1(BlinkTestHostMsg_SetPopupBlockingEnabled,
bool /* block_popups */)
#endif // CONTENT_SHELL_COMMON_WEB_TEST_BLINK_TEST_MESSAGES_H_ #endif // CONTENT_SHELL_COMMON_WEB_TEST_BLINK_TEST_MESSAGES_H_
...@@ -184,7 +184,7 @@ void BlinkTestRunner::SetEditCommand(const std::string& name, ...@@ -184,7 +184,7 @@ void BlinkTestRunner::SetEditCommand(const std::string& name,
} }
void BlinkTestRunner::PrintMessageToStderr(const std::string& message) { void BlinkTestRunner::PrintMessageToStderr(const std::string& message) {
Send(new BlinkTestHostMsg_PrintMessageToStderr(routing_id(), message)); GetWebTestClientRemote().PrintMessageToStderr(message);
} }
void BlinkTestRunner::PrintMessage(const std::string& message) { void BlinkTestRunner::PrintMessage(const std::string& message) {
...@@ -262,8 +262,7 @@ void BlinkTestRunner::ApplyPreferences() { ...@@ -262,8 +262,7 @@ void BlinkTestRunner::ApplyPreferences() {
} }
void BlinkTestRunner::SetPopupBlockingEnabled(bool block_popups) { void BlinkTestRunner::SetPopupBlockingEnabled(bool block_popups) {
Send( GetWebTestClientRemote().SetPopupBlockingEnabled(block_popups);
new BlinkTestHostMsg_SetPopupBlockingEnabled(routing_id(), block_popups));
} }
void BlinkTestRunner::UseUnfortunateSynchronousResizeMode(bool enable) { void BlinkTestRunner::UseUnfortunateSynchronousResizeMode(bool enable) {
...@@ -291,7 +290,7 @@ void BlinkTestRunner::ResetAutoResizeMode() { ...@@ -291,7 +290,7 @@ void BlinkTestRunner::ResetAutoResizeMode() {
} }
void BlinkTestRunner::NavigateSecondaryWindow(const GURL& url) { void BlinkTestRunner::NavigateSecondaryWindow(const GURL& url) {
Send(new BlinkTestHostMsg_NavigateSecondaryWindow(routing_id(), url)); GetWebTestClientRemote().NavigateSecondaryWindow(url);
} }
void BlinkTestRunner::InspectSecondaryWindow() { void BlinkTestRunner::InspectSecondaryWindow() {
...@@ -360,20 +359,19 @@ void BlinkTestRunner::SetBluetoothFakeAdapter(const std::string& adapter_name, ...@@ -360,20 +359,19 @@ void BlinkTestRunner::SetBluetoothFakeAdapter(const std::string& adapter_name,
} }
void BlinkTestRunner::SetBluetoothManualChooser(bool enable) { void BlinkTestRunner::SetBluetoothManualChooser(bool enable) {
Send(new BlinkTestHostMsg_SetBluetoothManualChooser(routing_id(), enable)); GetWebTestClientRemote().SetBluetoothManualChooser(enable);
} }
void BlinkTestRunner::GetBluetoothManualChooserEvents( void BlinkTestRunner::GetBluetoothManualChooserEvents(
base::OnceCallback<void(const std::vector<std::string>&)> callback) { base::OnceCallback<void(const std::vector<std::string>&)> callback) {
get_bluetooth_events_callbacks_.push_back(std::move(callback)); get_bluetooth_events_callbacks_.push_back(std::move(callback));
Send(new BlinkTestHostMsg_GetBluetoothManualChooserEvents(routing_id())); GetWebTestClientRemote().GetBluetoothManualChooserEvents();
} }
void BlinkTestRunner::SendBluetoothManualChooserEvent( void BlinkTestRunner::SendBluetoothManualChooserEvent(
const std::string& event, const std::string& event,
const std::string& argument) { const std::string& argument) {
Send(new BlinkTestHostMsg_SendBluetoothManualChooserEvent(routing_id(), event, GetWebTestClientRemote().SendBluetoothManualChooserEvent(event, argument);
argument));
} }
void BlinkTestRunner::SetFocus(blink::WebView* web_view, bool focus) { void BlinkTestRunner::SetFocus(blink::WebView* web_view, bool focus) {
...@@ -529,7 +527,7 @@ void BlinkTestRunner::CaptureLocalLayoutDump() { ...@@ -529,7 +527,7 @@ void BlinkTestRunner::CaptureLocalLayoutDump() {
// TODO(vmpstr): Since CaptureDump is called from the browser, we can be // TODO(vmpstr): Since CaptureDump is called from the browser, we can be
// smart and move this logic directly to the browser. // smart and move this logic directly to the browser.
waiting_for_layout_dump_results_ = true; waiting_for_layout_dump_results_ = true;
Send(new BlinkTestHostMsg_InitiateLayoutDump(routing_id())); GetWebTestClientRemote().InitiateLayoutDump();
} }
} }
...@@ -590,7 +588,7 @@ void BlinkTestRunner::CaptureDumpComplete() { ...@@ -590,7 +588,7 @@ void BlinkTestRunner::CaptureDumpComplete() {
} }
void BlinkTestRunner::CloseRemainingWindows() { void BlinkTestRunner::CloseRemainingWindows() {
Send(new BlinkTestHostMsg_CloseRemainingWindows(routing_id())); GetWebTestClientRemote().CloseRemainingWindows();
} }
void BlinkTestRunner::DeleteAllCookies() { void BlinkTestRunner::DeleteAllCookies() {
...@@ -602,16 +600,16 @@ int BlinkTestRunner::NavigationEntryCount() { ...@@ -602,16 +600,16 @@ int BlinkTestRunner::NavigationEntryCount() {
} }
void BlinkTestRunner::GoToOffset(int offset) { void BlinkTestRunner::GoToOffset(int offset) {
Send(new BlinkTestHostMsg_GoToOffset(routing_id(), offset)); GetWebTestClientRemote().GoToOffset(offset);
} }
void BlinkTestRunner::Reload() { void BlinkTestRunner::Reload() {
Send(new BlinkTestHostMsg_Reload(routing_id())); GetWebTestClientRemote().Reload();
} }
void BlinkTestRunner::LoadURLForFrame(const WebURL& url, void BlinkTestRunner::LoadURLForFrame(const WebURL& url,
const std::string& frame_name) { const std::string& frame_name) {
Send(new BlinkTestHostMsg_LoadURLForFrame(routing_id(), url, frame_name)); GetWebTestClientRemote().LoadURLForFrame(url, frame_name);
} }
bool BlinkTestRunner::AllowExternalPages() { bool BlinkTestRunner::AllowExternalPages() {
...@@ -728,7 +726,7 @@ void BlinkTestRunner::DidCommitNavigationInMainFrame() { ...@@ -728,7 +726,7 @@ void BlinkTestRunner::DidCommitNavigationInMainFrame() {
if (!url.IsAboutBlank()) if (!url.IsAboutBlank())
return; return;
waiting_for_reset_ = false; waiting_for_reset_ = false;
Send(new BlinkTestHostMsg_ResetDone(routing_id())); GetWebTestClientRemote().ResetDone();
} }
// Private methods ----------------------------------------------------------- // Private methods -----------------------------------------------------------
...@@ -742,6 +740,14 @@ BlinkTestRunner::GetBluetoothFakeAdapterSetter() { ...@@ -742,6 +740,14 @@ BlinkTestRunner::GetBluetoothFakeAdapterSetter() {
return *bluetooth_fake_adapter_setter_; return *bluetooth_fake_adapter_setter_;
} }
mojom::WebTestClient& BlinkTestRunner::GetWebTestClientRemote() {
if (!web_test_client_remote_) {
RenderThread::Get()->BindHostReceiver(
web_test_client_remote_.BindNewPipeAndPassReceiver());
}
return *web_test_client_remote_;
}
void BlinkTestRunner::OnSetupSecondaryRenderer() { void BlinkTestRunner::OnSetupSecondaryRenderer() {
DCHECK(!is_main_window_); DCHECK(!is_main_window_);
......
...@@ -180,6 +180,9 @@ class BlinkTestRunner : public RenderViewObserver, ...@@ -180,6 +180,9 @@ class BlinkTestRunner : public RenderViewObserver,
mojo::Remote<mojom::WebTestBluetoothFakeAdapterSetter> mojo::Remote<mojom::WebTestBluetoothFakeAdapterSetter>
bluetooth_fake_adapter_setter_; bluetooth_fake_adapter_setter_;
mojom::WebTestClient& GetWebTestClientRemote();
mojo::Remote<mojom::WebTestClient> web_test_client_remote_;
test_runner::TestPreferences prefs_; test_runner::TestPreferences prefs_;
mojom::ShellTestConfigurationPtr test_config_; mojom::ShellTestConfigurationPtr test_config_;
......
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