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

Unified Diff: content/shell/test_runner/web_frame_test_client.cc

Issue 2678043002: Hide console log messages for imported WPT tests (Closed)
Patch Set: update platform specific expected files missed last time around 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
« no previous file with comments | « content/shell/test_runner/test_interfaces.cc ('k') | content/shell/test_runner/web_test_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/test_runner/web_frame_test_client.cc
diff --git a/content/shell/test_runner/web_frame_test_client.cc b/content/shell/test_runner/web_frame_test_client.cc
index ac85df245e22584c5628b14d64a80034f98aec02..5f334ddb4467b1c12f20660cdccb5f3e230fc21f 100644
--- a/content/shell/test_runner/web_frame_test_client.cc
+++ b/content/shell/test_runner/web_frame_test_client.cc
@@ -648,10 +648,15 @@ void WebFrameTestClient::didAddMessageToConsole(
default:
level = "MESSAGE";
}
- delegate_->PrintMessage(std::string("CONSOLE ") + level + ": ");
+ std::string console_message(std::string("CONSOLE ") + level + ": ");
if (source_line) {
- delegate_->PrintMessage(base::StringPrintf("line %d: ", source_line));
+ console_message += base::StringPrintf("line %d: ", source_line);
}
+ // Console messages shouldn't be included in the expected output for
+ // web-platform-tests because they may create non-determinism not
+ // intended by the test author. They are still included in the stderr
+ // output for debug purposes.
+ bool dump_to_stderr = test_runner()->is_web_platform_tests_mode();
if (!message.text.isEmpty()) {
std::string new_message;
new_message = message.text.utf8();
@@ -660,9 +665,15 @@ void WebFrameTestClient::didAddMessageToConsole(
new_message = new_message.substr(0, file_protocol) +
URLSuitableForTestResult(new_message.substr(file_protocol));
}
- delegate_->PrintMessage(new_message);
+ console_message += new_message;
+ }
+ console_message += "\n";
+
+ if (dump_to_stderr) {
+ delegate_->PrintMessageToStderr(console_message);
+ } else {
+ delegate_->PrintMessage(console_message);
}
- delegate_->PrintMessage(std::string("\n"));
}
blink::WebNavigationPolicy WebFrameTestClient::decidePolicyForNavigation(
« no previous file with comments | « content/shell/test_runner/test_interfaces.cc ('k') | content/shell/test_runner/web_test_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698