| OLD | NEW |
| 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 "components/test_runner/web_frame_test_client.h" | 5 #include "components/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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 new_message = new_message.substr(0, file_protocol) + | 650 new_message = new_message.substr(0, file_protocol) + |
| 651 URLSuitableForTestResult(new_message.substr(file_protocol)); | 651 URLSuitableForTestResult(new_message.substr(file_protocol)); |
| 652 } | 652 } |
| 653 delegate_->PrintMessage(new_message); | 653 delegate_->PrintMessage(new_message); |
| 654 } | 654 } |
| 655 delegate_->PrintMessage(std::string("\n")); | 655 delegate_->PrintMessage(std::string("\n")); |
| 656 } | 656 } |
| 657 | 657 |
| 658 blink::WebNavigationPolicy WebFrameTestClient::decidePolicyForNavigation( | 658 blink::WebNavigationPolicy WebFrameTestClient::decidePolicyForNavigation( |
| 659 const blink::WebFrameClient::NavigationPolicyInfo& info) { | 659 const blink::WebFrameClient::NavigationPolicyInfo& info) { |
| 660 // PlzNavigate |
| 661 // Navigation requests initiated by the renderer have checked navigation |
| 662 // policy when the navigation was sent to the browser. Some layout tests |
| 663 // expect that navigation policy is only checked once. |
| 664 if (delegate_->IsNavigationInitiatedByRenderer(info.urlRequest)) |
| 665 return info.defaultPolicy; |
| 666 |
| 660 if (test_runner()->shouldDumpNavigationPolicy()) { | 667 if (test_runner()->shouldDumpNavigationPolicy()) { |
| 661 delegate_->PrintMessage("Default policy for navigation to '" + | 668 delegate_->PrintMessage("Default policy for navigation to '" + |
| 662 URLDescription(info.urlRequest.url()) + "' is '" + | 669 URLDescription(info.urlRequest.url()) + "' is '" + |
| 663 WebNavigationPolicyToString(info.defaultPolicy) + | 670 WebNavigationPolicyToString(info.defaultPolicy) + |
| 664 "'\n"); | 671 "'\n"); |
| 665 } | 672 } |
| 666 | 673 |
| 667 blink::WebNavigationPolicy result; | 674 blink::WebNavigationPolicy result; |
| 668 if (!test_runner()->policyDelegateEnabled()) | 675 if (!test_runner()->policyDelegateEnabled()) |
| 669 return info.defaultPolicy; | 676 return info.defaultPolicy; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 blink::WebEffectiveConnectionType | 723 blink::WebEffectiveConnectionType |
| 717 WebFrameTestClient::getEffectiveConnectionType() { | 724 WebFrameTestClient::getEffectiveConnectionType() { |
| 718 return test_runner()->effective_connection_type(); | 725 return test_runner()->effective_connection_type(); |
| 719 } | 726 } |
| 720 | 727 |
| 721 TestRunner* WebFrameTestClient::test_runner() { | 728 TestRunner* WebFrameTestClient::test_runner() { |
| 722 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); | 729 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); |
| 723 } | 730 } |
| 724 | 731 |
| 725 } // namespace test_runner | 732 } // namespace test_runner |
| OLD | NEW |