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

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 missed mac expected.txt file Created 3 years, 10 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/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..13249efb247b2f1310c2cf2d44c0bbfd93f71e16 100644
--- a/content/shell/test_runner/web_frame_test_client.cc
+++ b/content/shell/test_runner/web_frame_test_client.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/strings/string_piece.h"
+#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "content/shell/test_runner/accessibility_controller.h"
@@ -648,9 +649,9 @@ void WebFrameTestClient::didAddMessageToConsole(
default:
level = "MESSAGE";
}
- delegate_->PrintMessage(std::string("CONSOLE ") + level + ": ");
+ std::string prefix(std::string("CONSOLE ") + level + ": ");
if (source_line) {
- delegate_->PrintMessage(base::StringPrintf("line %d: ", source_line));
+ prefix += base::StringPrintf("line %d: ", source_line);
}
if (!message.text.isEmpty()) {
std::string new_message;
@@ -660,9 +661,15 @@ void WebFrameTestClient::didAddMessageToConsole(
new_message = new_message.substr(0, file_protocol) +
URLSuitableForTestResult(new_message.substr(file_protocol));
}
- delegate_->PrintMessage(new_message);
+ for (auto s : base::SplitStringPieceUsingSubstr(
+ new_message, "\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL)) {
+ delegate_->PrintMessage(prefix);
+ delegate_->PrintMessage(s.as_string());
+ delegate_->PrintMessage(std::string("\n"));
+ }
+ } else {
+ delegate_->PrintMessage(prefix + "\n");
}
- delegate_->PrintMessage(std::string("\n"));
}
blink::WebNavigationPolicy WebFrameTestClient::decidePolicyForNavigation(

Powered by Google App Engine
This is Rietveld 408576698