Commit 19f479b8 authored by Peter Kvitek's avatar Peter Kvitek Committed by Commit Bot

Added dump-devtools-protocol command line switch.

Inspecting protocol log is a great way to analyze what's going on under
the hood of a test and should be instantly available.

Change-Id: I238499f50074cc1eb6b6666ecc19b2fce17ddbe6
Reviewed-on: https://chromium-review.googlesource.com/1147752Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Commit-Queue: Peter Kvitek <kvitekp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577684}
parent 821db804
......@@ -33,6 +33,7 @@ namespace headless {
namespace {
static const char kResetResults[] = "reset-results";
static const char kDumpDevToolsProtocol[] = "dump-devtools-protocol";
} // namespace
class HeadlessProtocolBrowserTest
......@@ -112,6 +113,10 @@ class HeadlessProtocolBrowserTest
}
if (method != "DONE") {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
kDumpDevToolsProtocol)) {
LOG(INFO) << "FromJS: " << json_message;
}
// Pass unhandled commands onto the inspector.
browser_devtools_client_->SendRawDevToolsMessage(json_message);
return;
......@@ -156,6 +161,12 @@ class HeadlessProtocolBrowserTest
void SendMessageToJS(const std::string& message) {
if (test_finished_)
return;
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
kDumpDevToolsProtocol)) {
LOG(INFO) << "ToJS: " << message;
}
std::string encoded;
base::Base64Encode(message, &encoded);
devtools_client_->GetRuntime()->Evaluate("onmessage(atob(\"" + encoded +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment