Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(653)

Unified Diff: content/shell/browser/layout_test/blink_test_controller.cc

Issue 2742623002: DevTools: improve test infrastructure w/ devtools driving the test (Closed)
Patch Set: fixup Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..2371eb503040a547073f5f33d99fcb5824ea8a15 100644
--- a/content/shell/browser/layout_test/blink_test_controller.cc
+++ b/content/shell/browser/layout_test/blink_test_controller.cc
@@ -229,6 +229,7 @@ BlinkTestController::BlinkTestController()
switches::kEnableLeakDetection)),
crash_when_leak_found_(false),
devtools_frontend_(NULL),
+ inspected_window_(NULL),
dgozman 2017/03/10 00:17:17 nullptr
render_process_host_observer_(this) {
CHECK(!instance_);
instance_ = this;
@@ -273,7 +274,7 @@ bool BlinkTestController::PrepareForLayoutTest(
if (test_url.spec().find("/inspector-unit/") == std::string::npos)
test_url_ = test_url;
else
- test_url_ = LayoutTestDevToolsFrontend::MapJSTestURL(test_url);
+ test_url_ = LayoutTestDevToolsFrontend::MapUnitTestURL(test_url);
did_send_initial_test_configuration_ = false;
printer_->reset();
frame_to_layout_dump_map_.clear();
@@ -290,7 +291,27 @@ 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_) {
+ if (test_url_.spec().find("/devtools-js/") != std::string::npos) {
+ if (devtools_frontend_ && inspected_window_) {
+ inspected_window_->LoadURL(GURL(url::kAboutBlankURL));
dgozman 2017/03/10 00:17:17 Did we detach at the end of previous test? It woul
+ test_url_ = LayoutTestDevToolsFrontend::MapIntegrationTestURL(test_url);
+ main_window_->LoadURL(test_url_);
+ } else {
+ inspected_window_ = content::Shell::CreateNewWindow(
+ browser_context, GURL(), NULL, initial_size_);
+ inspected_window_->LoadURL(GURL(url::kAboutBlankURL));
+ devtools_frontend_ = LayoutTestDevToolsFrontend::CreateDevToolsMainWindow(
+ *inspected_window_, test_url_.spec());
+ main_window_ = devtools_frontend_->frontend_shell();
+ test_url_ = LayoutTestDevToolsFrontend::MapIntegrationTestURL(test_url);
+ 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(),
@@ -883,7 +904,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_)
open_windows[i]->Close();
}
base::RunLoop().RunUntilIdle();

Powered by Google App Engine
This is Rietveld 408576698