diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-08 14:15:11 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-08 14:15:11 +0000 |
commit | 1ca4fac072a12890b72b899b48da00617f8429ef (patch) | |
tree | eefc5e7ed4732470224ac4160135255c5081c456 /content/shell/webkit_test_runner.cc | |
parent | 8b830e96fcb8abd0d59bd92e3199e6aae4fbec7c (diff) | |
download | chromium_src-1ca4fac072a12890b72b899b48da00617f8429ef.zip chromium_src-1ca4fac072a12890b72b899b48da00617f8429ef.tar.gz chromium_src-1ca4fac072a12890b72b899b48da00617f8429ef.tar.bz2 |
[content shell] add support for invoking testRunner.notifyDone in a different process
Some layout tests, e.g.
http/tests/navigation/no-referrer-target-blank.html create a new
process, and notifyDone() will be invoked in that new process. Add
support for forwarding that signal to the main test runner.
BUG=111316
R=mkwst@chromium.org
TEST=http/tests/navigation/no-referrer-target-blank.html does not time out
Review URL: https://codereview.chromium.org/13795002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192819 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell/webkit_test_runner.cc')
-rw-r--r-- | content/shell/webkit_test_runner.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/content/shell/webkit_test_runner.cc b/content/shell/webkit_test_runner.cc index ba6134c..967e7b0 100644 --- a/content/shell/webkit_test_runner.cc +++ b/content/shell/webkit_test_runner.cc @@ -47,6 +47,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebTestingSupport.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/WebTask.h" @@ -73,6 +74,7 @@ using WebKit::WebMediaPlayer; using WebKit::WebMediaPlayerClient; using WebKit::WebPoint; using WebKit::WebRect; +using WebKit::WebScriptSource; using WebKit::WebSize; using WebKit::WebString; using WebKit::WebURL; @@ -405,8 +407,10 @@ void WebKitTestRunner::setLocale(const std::string& locale) { } void WebKitTestRunner::testFinished() { - if (!is_main_window_) + if (!is_main_window_) { + Send(new ShellViewHostMsg_TestFinishedInSecondaryWindow(routing_id())); return; + } WebTestInterfaces* interfaces = ShellRenderProcessObserver::GetInstance()->test_interfaces(); interfaces->setTestIsRunning(false); @@ -517,6 +521,7 @@ bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) { OnSetTestConfiguration) IPC_MESSAGE_HANDLER(ShellViewMsg_SessionHistory, OnSessionHistory) IPC_MESSAGE_HANDLER(ShellViewMsg_Reset, OnReset) + IPC_MESSAGE_HANDLER(ShellViewMsg_NotifyDone, OnNotifyDone) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -525,6 +530,13 @@ bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) { void WebKitTestRunner::Navigate(const GURL& url) { focus_on_next_commit_ = true; + if (!is_main_window_ && + ShellRenderProcessObserver::GetInstance()->main_test_runner() == this) { + WebTestInterfaces* interfaces = + ShellRenderProcessObserver::GetInstance()->test_interfaces(); + interfaces->setTestIsRunning(true); + interfaces->configureForTestWithURL(GURL(), false); + } } void WebKitTestRunner::DidCommitProvisionalLoad(WebFrame* frame, @@ -661,4 +673,9 @@ void WebKitTestRunner::OnReset() { Send(new ShellViewHostMsg_ResetDone(routing_id())); } +void WebKitTestRunner::OnNotifyDone() { + render_view()->GetWebView()->mainFrame()->executeScript( + WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); +} + } // namespace content |