Index: content/shell/browser/webkit_test_controller.cc |
diff --git a/content/shell/browser/webkit_test_controller.cc b/content/shell/browser/webkit_test_controller.cc |
index 3712d32fe4759afd069aac557f05fea6c990e084..6d8430eeaa7b9808036504d2a7c4ce4691a585bc 100644 |
--- a/content/shell/browser/webkit_test_controller.cc |
+++ b/content/shell/browser/webkit_test_controller.cc |
@@ -205,7 +205,8 @@ WebKitTestController::WebKitTestController() |
is_leak_detection_enabled_( |
base::CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kEnableLeakDetection)), |
- crash_when_leak_found_(false) { |
+ crash_when_leak_found_(false), |
+ devtools_frontend_(NULL) { |
CHECK(!instance_); |
instance_ = this; |
@@ -586,11 +587,19 @@ void WebKitTestController::OnClearDevToolsLocalStorage() { |
void WebKitTestController::OnShowDevTools(const std::string& settings, |
const std::string& frontend_url) { |
- main_window_->ShowDevToolsForTest(settings, frontend_url); |
+ if (!devtools_frontend_) { |
+ devtools_frontend_ = LayoutTestDevToolsFrontend::Show( |
+ main_window_->web_contents(), settings, frontend_url); |
+ } else { |
+ devtools_frontend_->SwitchToTarget(main_window_->web_contents()); |
+ } |
+ devtools_frontend_->Activate(); |
+ devtools_frontend_->Focus(); |
} |
void WebKitTestController::OnCloseDevTools() { |
- main_window_->CloseDevTools(); |
+ if (devtools_frontend_) |
+ devtools_frontend_->DisconnectFromTarget(); |
} |
void WebKitTestController::OnGoToOffset(int offset) { |
@@ -653,8 +662,10 @@ void WebKitTestController::OnCaptureSessionHistory() { |
void WebKitTestController::OnCloseRemainingWindows() { |
DevToolsAgentHost::DetachAllClients(); |
std::vector<Shell*> open_windows(Shell::windows()); |
+ Shell* devtools_shell = devtools_frontend_ ? |
+ devtools_frontend_->frontend_shell() : NULL; |
for (size_t i = 0; i < open_windows.size(); ++i) { |
- if (open_windows[i] != main_window_) |
+ if (open_windows[i] != main_window_ && open_windows[i] != devtools_shell) |
open_windows[i]->Close(); |
} |
base::MessageLoop::current()->RunUntilIdle(); |