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

Side by Side Diff: content/shell/test_runner/web_frame_test_client.cc

Issue 2678043002: Hide console log messages for imported WPT tests (Closed)
Patch Set: Revert python change 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/shell/test_runner/web_frame_test_client.h" 5 #include "content/shell/test_runner/web_frame_test_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 break; 641 break;
642 case blink::WebConsoleMessage::LevelWarning: 642 case blink::WebConsoleMessage::LevelWarning:
643 level = "WARNING"; 643 level = "WARNING";
644 break; 644 break;
645 case blink::WebConsoleMessage::LevelError: 645 case blink::WebConsoleMessage::LevelError:
646 level = "ERROR"; 646 level = "ERROR";
647 break; 647 break;
648 default: 648 default:
649 level = "MESSAGE"; 649 level = "MESSAGE";
650 } 650 }
651 delegate_->PrintMessage(std::string("CONSOLE ") + level + ": "); 651 std::string consoleMessage(std::string("CONSOLE ") + level + ": ");
652 if (source_line) { 652 if (source_line) {
653 delegate_->PrintMessage(base::StringPrintf("line %d: ", source_line)); 653 consoleMessage += base::StringPrintf("line %d: ", source_line);
654 } 654 }
655 bool dump_to_stderr = test_runner()->is_web_platform_tests_mode();
Rick Byers 2017/03/09 13:22:24 nit: add a comment saying why, eg. "Console messag
Dan Elphick 2017/03/09 13:41:40 Done.
655 if (!message.text.isEmpty()) { 656 if (!message.text.isEmpty()) {
656 std::string new_message; 657 std::string new_message;
657 new_message = message.text.utf8(); 658 new_message = message.text.utf8();
658 size_t file_protocol = new_message.find("file://"); 659 size_t file_protocol = new_message.find("file://");
659 if (file_protocol != std::string::npos) { 660 if (file_protocol != std::string::npos) {
660 new_message = new_message.substr(0, file_protocol) + 661 new_message = new_message.substr(0, file_protocol) +
661 URLSuitableForTestResult(new_message.substr(file_protocol)); 662 URLSuitableForTestResult(new_message.substr(file_protocol));
662 } 663 }
663 delegate_->PrintMessage(new_message); 664 consoleMessage += new_message;
664 } 665 }
665 delegate_->PrintMessage(std::string("\n")); 666 consoleMessage += "\n";
667
668 if (dump_to_stderr) {
669 delegate_->PrintLogMessage(consoleMessage);
670 } else {
671 delegate_->PrintMessage(consoleMessage);
672 }
666 } 673 }
667 674
668 blink::WebNavigationPolicy WebFrameTestClient::decidePolicyForNavigation( 675 blink::WebNavigationPolicy WebFrameTestClient::decidePolicyForNavigation(
669 const blink::WebFrameClient::NavigationPolicyInfo& info) { 676 const blink::WebFrameClient::NavigationPolicyInfo& info) {
670 // PlzNavigate 677 // PlzNavigate
671 // Navigation requests initiated by the renderer have checked navigation 678 // Navigation requests initiated by the renderer have checked navigation
672 // policy when the navigation was sent to the browser. Some layout tests 679 // policy when the navigation was sent to the browser. Some layout tests
673 // expect that navigation policy is only checked once. 680 // expect that navigation policy is only checked once.
674 if (delegate_->IsNavigationInitiatedByRenderer(info.urlRequest)) 681 if (delegate_->IsNavigationInitiatedByRenderer(info.urlRequest))
675 return info.defaultPolicy; 682 return info.defaultPolicy;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 blink::WebEffectiveConnectionType 740 blink::WebEffectiveConnectionType
734 WebFrameTestClient::getEffectiveConnectionType() { 741 WebFrameTestClient::getEffectiveConnectionType() {
735 return test_runner()->effective_connection_type(); 742 return test_runner()->effective_connection_type();
736 } 743 }
737 744
738 TestRunner* WebFrameTestClient::test_runner() { 745 TestRunner* WebFrameTestClient::test_runner() {
739 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); 746 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner();
740 } 747 }
741 748
742 } // namespace test_runner 749 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698