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

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

Issue 2942573003: [DevTools] New harness for inspector-protocol layout tests (Closed)
Patch Set: Protocol -> dp Created 3 years, 6 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 adea7036bdee1b106509502bed8c65c038735c1f..87a7408ab5022bbfc4552a1b846188af67252e38 100644
--- a/content/shell/browser/layout_test/blink_test_controller.cc
+++ b/content/shell/browser/layout_test/blink_test_controller.cc
@@ -44,6 +44,7 @@
#include "content/public/common/bindings_policy.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
+#include "content/shell/browser/layout_test/devtools_protocol_test_bindings.h"
#include "content/shell/browser/layout_test/layout_test_bluetooth_chooser_factory.h"
#include "content/shell/browser/layout_test/layout_test_content_browser_client.h"
#include "content/shell/browser/layout_test/layout_test_devtools_bindings.h"
@@ -296,10 +297,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;
- else
+ GURL devtools_protocol_test_url =
+ DevToolsProtocolTestBindings::GetProtocolTestURL(test_url);
+ if (!devtools_protocol_test_url.is_empty())
+ test_url_ = devtools_protocol_test_url;
+ else if (test_url.spec().find("/inspector-unit/") != std::string::npos)
test_url_ = LayoutTestDevToolsBindings::MapJSTestURL(test_url);
+ else
+ test_url_ = test_url;
did_send_initial_test_configuration_ = false;
printer_->reset();
frame_to_layout_dump_map_.clear();
@@ -323,6 +328,10 @@ bool BlinkTestController::PrepareForLayoutTest(
NULL,
initial_size_);
WebContentsObserver::Observe(main_window_->web_contents());
+ if (!devtools_protocol_test_url.is_empty()) {
+ devtools_protocol_test_bindings_.reset(
+ new DevToolsProtocolTestBindings(main_window_->web_contents()));
+ }
current_pid_ = base::kNullProcessId;
default_prefs_ =
main_window_->web_contents()->GetRenderViewHost()->GetWebkitPreferences();
@@ -344,6 +353,11 @@ bool BlinkTestController::PrepareForLayoutTest(
RenderViewHost* render_view_host =
main_window_->web_contents()->GetRenderViewHost();
+ if (!devtools_protocol_test_url.is_empty()) {
+ devtools_protocol_test_bindings_.reset(
+ new DevToolsProtocolTestBindings(main_window_->web_contents()));
+ }
+
// Compositing tests override the default preferences (see
// BlinkTestController::OverrideWebkitPrefs) so we force them to be
// calculated again to ensure is_compositing_test_ changes are picked up.
@@ -604,6 +618,7 @@ void BlinkTestController::DiscardMainWindow() {
// loop. Otherwise, we're already outside of the message loop, and we just
// discard the main window.
devtools_bindings_.reset();
+ devtools_protocol_test_bindings_.reset();
WebContentsObserver::Observe(NULL);
if (test_phase_ != BETWEEN_TESTS) {
Shell::CloseAllWindows();
@@ -684,6 +699,7 @@ void BlinkTestController::OnTestFinished() {
RenderViewHost* render_view_host =
main_window_->web_contents()->GetRenderViewHost();
main_window_->web_contents()->ExitFullscreen(/*will_cause_resize=*/false);
+ devtools_protocol_test_bindings_.reset();
ShellBrowserContext* browser_context =
ShellContentBrowserClient::Get()->browser_context();

Powered by Google App Engine
This is Rietveld 408576698