summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-04 13:32:16 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-04 13:32:16 +0000
commitb778e18ea843df861a513154df8ba6ccfc2c4249 (patch)
tree320469cb58eda54e1cbd8cf32df17a0d36b7ec47
parent3aac3650d0848b2e93e20f0aeb8a716677f43925 (diff)
downloadchromium_src-b778e18ea843df861a513154df8ba6ccfc2c4249.zip
chromium_src-b778e18ea843df861a513154df8ba6ccfc2c4249.tar.gz
chromium_src-b778e18ea843df861a513154df8ba6ccfc2c4249.tar.bz2
[content shell] implement WebTestDelegate::closeRemainingWindows
The method doesn't do a lot yet, since we close all windows at the end of each test anyway, but it's needed once we start reusing the main window BUG=171128 R=thakis@chromium.org Review URL: https://codereview.chromium.org/12379073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185887 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/shell/shell_messages.h1
-rw-r--r--content/shell/webkit_test_controller.cc13
-rw-r--r--content/shell/webkit_test_controller.h1
-rw-r--r--content/shell/webkit_test_runner.cc4
4 files changed, 16 insertions, 3 deletions
diff --git a/content/shell/shell_messages.h b/content/shell/shell_messages.h
index 5479557..8c4d804 100644
--- a/content/shell/shell_messages.h
+++ b/content/shell/shell_messages.h
@@ -108,3 +108,4 @@ IPC_MESSAGE_ROUTED1(ShellViewHostMsg_SetDeviceScaleFactor,
IPC_MESSAGE_ROUTED1(ShellViewHostMsg_SetFocus,
bool /* focus */)
IPC_MESSAGE_ROUTED0(ShellViewHostMsg_CaptureSessionHistory)
+IPC_MESSAGE_ROUTED0(ShellViewHostMsg_CloseRemainingWindows)
diff --git a/content/shell/webkit_test_controller.cc b/content/shell/webkit_test_controller.cc
index 147c4a1..4eb223e 100644
--- a/content/shell/webkit_test_controller.cc
+++ b/content/shell/webkit_test_controller.cc
@@ -12,6 +12,7 @@
#include "base/run_loop.h"
#include "base/string_number_conversions.h"
#include "base/stringprintf.h"
+#include "content/public/browser/devtools_manager.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_service.h"
@@ -291,6 +292,8 @@ bool WebKitTestController::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ShellViewHostMsg_SetFocus, OnSetFocus)
IPC_MESSAGE_HANDLER(ShellViewHostMsg_CaptureSessionHistory,
OnCaptureSessionHistory)
+ IPC_MESSAGE_HANDLER(ShellViewHostMsg_CloseRemainingWindows,
+ OnCloseRemainingWindows)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -548,4 +551,14 @@ void WebKitTestController::OnCaptureSessionHistory() {
current_entry_indexes));
}
+void WebKitTestController::OnCloseRemainingWindows() {
+ DevToolsManager::GetInstance()->CloseAllClientHosts();
+ std::vector<Shell*> open_windows(Shell::windows());
+ for (size_t i = 0; i < open_windows.size(); ++i) {
+ if (open_windows[i] != main_window_)
+ open_windows[i]->Close();
+ }
+ MessageLoop::current()->RunUntilIdle();
+}
+
} // namespace content
diff --git a/content/shell/webkit_test_controller.h b/content/shell/webkit_test_controller.h
index c17457e..a4fcc40 100644
--- a/content/shell/webkit_test_controller.h
+++ b/content/shell/webkit_test_controller.h
@@ -139,6 +139,7 @@ class WebKitTestController : public base::NonThreadSafe,
void OnSetClientWindowRect(const gfx::Rect& rect);
void OnSetFocus(bool focus);
void OnCaptureSessionHistory();
+ void OnCloseRemainingWindows();
scoped_ptr<WebKitTestResultPrinter> printer_;
diff --git a/content/shell/webkit_test_runner.cc b/content/shell/webkit_test_runner.cc
index 27ccf0e..a72f0ea 100644
--- a/content/shell/webkit_test_runner.cc
+++ b/content/shell/webkit_test_runner.cc
@@ -379,9 +379,7 @@ int WebKitTestRunner::layoutTestTimeout() {
}
void WebKitTestRunner::closeRemainingWindows() {
- // We currently always close all remaining windows at the end of each test.
- // TODO(jochen): Reuse the renderer across tests instead of closing all
- // windows. http://crbug.com/171128
+ Send(new ShellViewHostMsg_CloseRemainingWindows(routing_id()));
}
int WebKitTestRunner::navigationEntryCount() {