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 11 matching lines...) Expand all Loading... |
22 #include "components/test_runner/web_frame_test_proxy.h" | 22 #include "components/test_runner/web_frame_test_proxy.h" |
23 #include "components/test_runner/web_test_delegate.h" | 23 #include "components/test_runner/web_test_delegate.h" |
24 #include "components/test_runner/web_view_test_proxy.h" | 24 #include "components/test_runner/web_view_test_proxy.h" |
25 #include "components/test_runner/web_widget_test_proxy.h" | 25 #include "components/test_runner/web_widget_test_proxy.h" |
26 #include "net/base/net_errors.h" | 26 #include "net/base/net_errors.h" |
27 #include "third_party/WebKit/public/platform/WebString.h" | 27 #include "third_party/WebKit/public/platform/WebString.h" |
28 #include "third_party/WebKit/public/platform/WebURL.h" | 28 #include "third_party/WebKit/public/platform/WebURL.h" |
29 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 29 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
30 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 30 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
31 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 31 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
| 32 #include "third_party/WebKit/public/web/WebDataSource.h" |
32 #include "third_party/WebKit/public/web/WebElement.h" | 33 #include "third_party/WebKit/public/web/WebElement.h" |
33 #include "third_party/WebKit/public/web/WebFrame.h" | 34 #include "third_party/WebKit/public/web/WebFrame.h" |
34 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 35 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
35 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 36 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
36 #include "third_party/WebKit/public/web/WebPluginParams.h" | 37 #include "third_party/WebKit/public/web/WebPluginParams.h" |
37 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 38 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
38 #include "third_party/WebKit/public/web/WebView.h" | 39 #include "third_party/WebKit/public/web/WebView.h" |
39 #include "url/gurl.h" | 40 #include "url/gurl.h" |
40 #include "url/url_constants.h" | 41 #include "url/url_constants.h" |
41 | 42 |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 } | 406 } |
406 } | 407 } |
407 | 408 |
408 void WebFrameTestClient::loadErrorPage(int reason) { | 409 void WebFrameTestClient::loadErrorPage(int reason) { |
409 if (test_runner()->shouldDumpFrameLoadCallbacks()) { | 410 if (test_runner()->shouldDumpFrameLoadCallbacks()) { |
410 delegate_->PrintMessage(base::StringPrintf( | 411 delegate_->PrintMessage(base::StringPrintf( |
411 "- loadErrorPage: %s\n", net::ErrorToString(reason).c_str())); | 412 "- loadErrorPage: %s\n", net::ErrorToString(reason).c_str())); |
412 } | 413 } |
413 } | 414 } |
414 | 415 |
415 void WebFrameTestClient::didStartProvisionalLoad(blink::WebLocalFrame* frame) { | 416 void WebFrameTestClient::didStartProvisionalLoad( |
416 test_runner()->tryToSetTopLoadingFrame(frame); | 417 blink::WebDataSource* data_source) { |
| 418 // PlzNavigate |
| 419 // A provisional load notification is received when a frame navigation is |
| 420 // sent to the browser. We don't want to log it again during commit. |
| 421 if (delegate_->IsNavigationInitiatedByRenderer(data_source->getRequest())) |
| 422 return; |
| 423 |
| 424 test_runner()->tryToSetTopLoadingFrame( |
| 425 web_frame_test_proxy_base_->web_frame()); |
417 | 426 |
418 if (test_runner()->shouldDumpFrameLoadCallbacks()) { | 427 if (test_runner()->shouldDumpFrameLoadCallbacks()) { |
419 PrintFrameDescription(delegate_, frame); | 428 PrintFrameDescription(delegate_, web_frame_test_proxy_base_->web_frame()); |
420 delegate_->PrintMessage(" - didStartProvisionalLoadForFrame\n"); | 429 delegate_->PrintMessage(" - didStartProvisionalLoadForFrame\n"); |
421 } | 430 } |
422 | 431 |
423 if (test_runner()->shouldDumpUserGestureInFrameLoadCallbacks()) { | 432 if (test_runner()->shouldDumpUserGestureInFrameLoadCallbacks()) { |
424 PrintFrameuserGestureStatus(delegate_, frame, | 433 PrintFrameuserGestureStatus(delegate_, |
| 434 web_frame_test_proxy_base_->web_frame(), |
425 " - in didStartProvisionalLoadForFrame\n"); | 435 " - in didStartProvisionalLoadForFrame\n"); |
426 } | 436 } |
427 } | 437 } |
428 | 438 |
429 void WebFrameTestClient::didReceiveServerRedirectForProvisionalLoad( | 439 void WebFrameTestClient::didReceiveServerRedirectForProvisionalLoad( |
430 blink::WebLocalFrame* frame) { | 440 blink::WebLocalFrame* frame) { |
431 if (test_runner()->shouldDumpFrameLoadCallbacks()) { | 441 if (test_runner()->shouldDumpFrameLoadCallbacks()) { |
432 PrintFrameDescription(delegate_, frame); | 442 PrintFrameDescription(delegate_, frame); |
433 delegate_->PrintMessage( | 443 delegate_->PrintMessage( |
434 " - didReceiveServerRedirectForProvisionalLoadForFrame\n"); | 444 " - didReceiveServerRedirectForProvisionalLoadForFrame\n"); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 blink::WebEffectiveConnectionType | 726 blink::WebEffectiveConnectionType |
717 WebFrameTestClient::getEffectiveConnectionType() { | 727 WebFrameTestClient::getEffectiveConnectionType() { |
718 return test_runner()->effective_connection_type(); | 728 return test_runner()->effective_connection_type(); |
719 } | 729 } |
720 | 730 |
721 TestRunner* WebFrameTestClient::test_runner() { | 731 TestRunner* WebFrameTestClient::test_runner() { |
722 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); | 732 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); |
723 } | 733 } |
724 | 734 |
725 } // namespace test_runner | 735 } // namespace test_runner |
OLD | NEW |