Index: content/shell/browser/layout_test/blink_test_controller.cc |
diff --git a/content/shell/browser/layout_test/blink_test_controller.cc b/content/shell/browser/layout_test/blink_test_controller.cc |
index 0a5460823bd3c1354863413c0a2c2033d60baac6..0624f93c02d71ae66e9ae92ff265d9c52386260b 100644 |
--- a/content/shell/browser/layout_test/blink_test_controller.cc |
+++ b/content/shell/browser/layout_test/blink_test_controller.cc |
@@ -270,10 +270,14 @@ bool BlinkTestController::PrepareForLayoutTest( |
current_working_directory_ = current_working_directory; |
enable_pixel_dumping_ = enable_pixel_dumping; |
expected_pixel_hash_ = expected_pixel_hash; |
- if (test_url.spec().find("/inspector-unit/") == std::string::npos) |
- test_url_ = test_url; |
+ bool is_devtools_js_test = |
+ test_url.spec().find("/devtools-js/") != std::string::npos; |
+ if (test_url.spec().find("/inspector-unit/") != std::string::npos) |
+ test_url_ = LayoutTestDevToolsFrontend::MapUnitTestURL(test_url); |
+ else if (is_devtools_js_test) |
+ test_url_ = LayoutTestDevToolsFrontend::MapIntegrationTestURL(test_url); |
else |
- test_url_ = LayoutTestDevToolsFrontend::MapJSTestURL(test_url); |
+ test_url_ = test_url; |
did_send_initial_test_configuration_ = false; |
printer_->reset(); |
frame_to_layout_dump_map_.clear(); |
@@ -290,12 +294,31 @@ bool BlinkTestController::PrepareForLayoutTest( |
// The W3C SVG layout tests use a different size than the other layout tests. |
if (test_url_.spec().find("W3C-SVG-1.1") != std::string::npos) |
initial_size_ = gfx::Size(kTestSVGWindowWidthDip, kTestSVGWindowHeightDip); |
- if (!main_window_) { |
- main_window_ = content::Shell::CreateNewWindow( |
- browser_context, |
- GURL(), |
- NULL, |
- initial_size_); |
+ if (is_devtools_js_test) { |
+ if (devtools_frontend_ && inspected_window_) { |
+ devtools_frontend_->ReuseFrontend(std::string(), test_url_.spec()); |
+ inspected_window_->LoadURL(GURL(url::kAboutBlankURL)); |
+ DevToolsAgentHost::GetOrCreateFor(inspected_window_->web_contents()) |
+ ->AttachClient(devtools_frontend_); |
+ } else { |
+ inspected_window_.reset(content::Shell::CreateNewWindow( |
+ browser_context, GURL(), NULL, initial_size_)); |
+ inspected_window_->LoadURL(GURL(url::kAboutBlankURL)); |
+ if (devtools_frontend_) |
+ devtools_frontend_->Close(); |
+ devtools_frontend_ = LayoutTestDevToolsFrontend::CreateDevToolsMainWindow( |
+ *inspected_window_); |
+ main_window_ = devtools_frontend_->frontend_shell(); |
+ WebContentsObserver::Observe(main_window_->web_contents()); |
+ current_pid_ = base::kNullProcessId; |
+ default_prefs_ = main_window_->web_contents() |
+ ->GetRenderViewHost() |
+ ->GetWebkitPreferences(); |
+ main_window_->LoadURL(test_url_); |
+ } |
+ } else if (!main_window_) { |
+ main_window_ = content::Shell::CreateNewWindow(browser_context, GURL(), |
+ NULL, initial_size_); |
WebContentsObserver::Observe(main_window_->web_contents()); |
current_pid_ = base::kNullProcessId; |
default_prefs_ = |
@@ -883,7 +906,8 @@ void BlinkTestController::OnCloseRemainingWindows() { |
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_ && open_windows[i] != devtools_shell) |
+ if (open_windows[i] != main_window_ && open_windows[i] != devtools_shell && |
+ open_windows[i] != inspected_window_.get()) |
open_windows[i]->Close(); |
} |
base::RunLoop().RunUntilIdle(); |