summaryrefslogtreecommitdiffstats
path: root/content/shell
diff options
context:
space:
mode:
authorlukasza <lukasza@chromium.org>2016-03-08 10:30:57 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-08 18:32:32 +0000
commitf6b148302e76a6450d87ea49ef9e6f9836ca2639 (patch)
treea08cde72152c1c6b0d258b9676d34e10310f9410 /content/shell
parent313b8b29c4c53f1907e96adb9ae9d6ff0b30ed4b (diff)
downloadchromium_src-f6b148302e76a6450d87ea49ef9e6f9836ca2639.zip
chromium_src-f6b148302e76a6450d87ea49ef9e6f9836ca2639.tar.gz
chromium_src-f6b148302e76a6450d87ea49ef9e6f9836ca2639.tar.bz2
Quit BlinkTestRunner::TestFinished early if main frame is not local.
content::BlinkTestRunner::TestFinished assumes that main frame is local. This assumption only accidentally holds true today when running layout tests with --site-per-process flag - it holds true with OOPIFs, because today OOPIFs do not receive ShellViewMsg_SetTestConfiguration message which means that BlinkTestRunner::is_main_window_ is set to false in OOPIFs (even if they actually *are* in the main window). This assumption is needed for test_runner::TestRunner::CheckResponseMimeType and for the call to test_runner::DumpLayout from BlinkTestRunner::CaptureDump (which targets the main frame only). This CL makes sure that the assumption will hold true even if an equivalent of ShellViewMsg_SetTestConfiguration message is sent to OOPIFs in the future (i.e. after crrev.com/1750063002). This is done, by having OOPIFs ask the browser to forward TestFinished to the BlinkTestRunner where main frame is local (similarily to how this was already asked from renderers associated with secondary test windows). Because of this change, ...SecondaryWindow... is replaced with ...SecondaryRenderer... where applicable. Note - this CL prevents a crash in a future CL (https://crrev.com/1750063002), by enforcing the assumption described above (and exiting early if the assumption doesn't hold). OTOH, this CL does NOT actually cause ShellViewHostMsg_TestFinishedInSecondaryRenderer to be delivered to the browser in all the cases - there are extra issues that prevent that from happening (these issues are addressed in a later CL proposed at https://crrev.com/1765623003/). Not delivering the message is harmless and actually prevents test failures at this point (when runtime test flags are not yet replicated - until we land https://crrev.com/1715573002/). BUG=587175 Review URL: https://codereview.chromium.org/1746393002 Cr-Commit-Position: refs/heads/master@{#379870}
Diffstat (limited to 'content/shell')
-rw-r--r--content/shell/browser/layout_test/blink_test_controller.cc2
-rw-r--r--content/shell/browser/layout_test/blink_test_controller.h2
-rw-r--r--content/shell/browser/layout_test/notify_done_forwarder.cc8
-rw-r--r--content/shell/browser/layout_test/notify_done_forwarder.h2
-rw-r--r--content/shell/common/shell_messages.h6
-rw-r--r--content/shell/renderer/layout_test/blink_test_runner.cc4
6 files changed, 12 insertions, 12 deletions
diff --git a/content/shell/browser/layout_test/blink_test_controller.cc b/content/shell/browser/layout_test/blink_test_controller.cc
index 3793d4c..554159f 100644
--- a/content/shell/browser/layout_test/blink_test_controller.cc
+++ b/content/shell/browser/layout_test/blink_test_controller.cc
@@ -374,7 +374,7 @@ void BlinkTestController::OpenURL(const GURL& url) {
gfx::Size());
}
-void BlinkTestController::TestFinishedInSecondaryWindow() {
+void BlinkTestController::TestFinishedInSecondaryRenderer() {
RenderViewHost* render_view_host =
main_window_->web_contents()->GetRenderViewHost();
render_view_host->Send(
diff --git a/content/shell/browser/layout_test/blink_test_controller.h b/content/shell/browser/layout_test/blink_test_controller.h
index d170e6f..6ff85f7 100644
--- a/content/shell/browser/layout_test/blink_test_controller.h
+++ b/content/shell/browser/layout_test/blink_test_controller.h
@@ -140,7 +140,7 @@ class BlinkTestController : public base::NonThreadSafe,
void RendererUnresponsive();
void OverrideWebkitPrefs(WebPreferences* prefs);
void OpenURL(const GURL& url);
- void TestFinishedInSecondaryWindow();
+ void TestFinishedInSecondaryRenderer();
bool IsMainWindow(WebContents* web_contents) const;
scoped_ptr<BluetoothChooser> RunBluetoothChooser(
RenderFrameHost* frame,
diff --git a/content/shell/browser/layout_test/notify_done_forwarder.cc b/content/shell/browser/layout_test/notify_done_forwarder.cc
index 2a77f94..b921393 100644
--- a/content/shell/browser/layout_test/notify_done_forwarder.cc
+++ b/content/shell/browser/layout_test/notify_done_forwarder.cc
@@ -19,15 +19,15 @@ NotifyDoneForwarder::~NotifyDoneForwarder() {}
bool NotifyDoneForwarder::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(NotifyDoneForwarder, message)
- IPC_MESSAGE_HANDLER(ShellViewHostMsg_TestFinishedInSecondaryWindow,
- OnTestFinishedInSecondaryWindow)
+ IPC_MESSAGE_HANDLER(ShellViewHostMsg_TestFinishedInSecondaryRenderer,
+ OnTestFinishedInSecondaryRenderer)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
-void NotifyDoneForwarder::OnTestFinishedInSecondaryWindow() {
- BlinkTestController::Get()->TestFinishedInSecondaryWindow();
+void NotifyDoneForwarder::OnTestFinishedInSecondaryRenderer() {
+ BlinkTestController::Get()->TestFinishedInSecondaryRenderer();
}
} // namespace content
diff --git a/content/shell/browser/layout_test/notify_done_forwarder.h b/content/shell/browser/layout_test/notify_done_forwarder.h
index fd1b0c1..c512c24 100644
--- a/content/shell/browser/layout_test/notify_done_forwarder.h
+++ b/content/shell/browser/layout_test/notify_done_forwarder.h
@@ -24,7 +24,7 @@ class NotifyDoneForwarder : public WebContentsObserver,
explicit NotifyDoneForwarder(WebContents* web_contents);
- void OnTestFinishedInSecondaryWindow();
+ void OnTestFinishedInSecondaryRenderer();
DISALLOW_COPY_AND_ASSIGN(NotifyDoneForwarder);
};
diff --git a/content/shell/common/shell_messages.h b/content/shell/common/shell_messages.h
index 7a0b1f9..41fad06 100644
--- a/content/shell/common/shell_messages.h
+++ b/content/shell/common/shell_messages.h
@@ -48,8 +48,8 @@ IPC_MESSAGE_CONTROL1(ShellViewMsg_SetWebKitSourceDir,
IPC_MESSAGE_ROUTED1(ShellViewMsg_SetTestConfiguration,
content::ShellTestConfiguration)
-// Tells the main window that a secondary window in a different process invoked
-// notifyDone().
+// Tells the main window that a secondary renderer in a different process thinks
+// the test is finished.
IPC_MESSAGE_ROUTED0(ShellViewMsg_NotifyDone)
// Pushes a snapshot of the current session history from the browser process.
@@ -100,7 +100,7 @@ IPC_MESSAGE_ROUTED0(ShellViewHostMsg_TestFinished)
IPC_MESSAGE_ROUTED0(ShellViewHostMsg_ResetDone)
-IPC_MESSAGE_ROUTED0(ShellViewHostMsg_TestFinishedInSecondaryWindow)
+IPC_MESSAGE_ROUTED0(ShellViewHostMsg_TestFinishedInSecondaryRenderer)
// WebTestDelegate related.
IPC_MESSAGE_ROUTED1(ShellViewHostMsg_OverridePreferences,
diff --git a/content/shell/renderer/layout_test/blink_test_runner.cc b/content/shell/renderer/layout_test/blink_test_runner.cc
index 6337578..73f4fcc 100644
--- a/content/shell/renderer/layout_test/blink_test_runner.cc
+++ b/content/shell/renderer/layout_test/blink_test_runner.cc
@@ -611,8 +611,8 @@ void BlinkTestRunner::SetLocale(const std::string& locale) {
}
void BlinkTestRunner::TestFinished() {
- if (!is_main_window_) {
- Send(new ShellViewHostMsg_TestFinishedInSecondaryWindow(routing_id()));
+ if (!is_main_window_ || !render_view()->GetMainRenderFrame()) {
+ Send(new ShellViewHostMsg_TestFinishedInSecondaryRenderer(routing_id()));
return;
}
test_runner::WebTestInterfaces* interfaces =