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" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "components/test_runner/accessibility_controller.h" | 13 #include "components/test_runner/accessibility_controller.h" |
14 #include "components/test_runner/event_sender.h" | 14 #include "components/test_runner/event_sender.h" |
15 #include "components/test_runner/mock_color_chooser.h" | 15 #include "components/test_runner/mock_color_chooser.h" |
16 #include "components/test_runner/mock_screen_orientation_client.h" | 16 #include "components/test_runner/mock_screen_orientation_client.h" |
17 #include "components/test_runner/mock_web_user_media_client.h" | 17 #include "components/test_runner/mock_web_user_media_client.h" |
18 #include "components/test_runner/test_common.h" | 18 #include "components/test_runner/test_common.h" |
19 #include "components/test_runner/test_interfaces.h" | 19 #include "components/test_runner/test_interfaces.h" |
20 #include "components/test_runner/test_plugin.h" | 20 #include "components/test_runner/test_plugin.h" |
21 #include "components/test_runner/test_runner.h" | 21 #include "components/test_runner/test_runner.h" |
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 "third_party/WebKit/public/platform/WebString.h" | 27 #include "third_party/WebKit/public/platform/WebString.h" |
27 #include "third_party/WebKit/public/platform/WebURL.h" | 28 #include "third_party/WebKit/public/platform/WebURL.h" |
28 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 29 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
29 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 30 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
30 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 31 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
31 #include "third_party/WebKit/public/web/WebElement.h" | 32 #include "third_party/WebKit/public/web/WebElement.h" |
32 #include "third_party/WebKit/public/web/WebFrame.h" | 33 #include "third_party/WebKit/public/web/WebFrame.h" |
33 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 34 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
34 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 35 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
35 #include "third_party/WebKit/public/web/WebPluginParams.h" | 36 #include "third_party/WebKit/public/web/WebPluginParams.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 std::string("Downloading URL with suggested filename \"") + | 391 std::string("Downloading URL with suggested filename \"") + |
391 suggested_name.utf8() + "\"\n"); | 392 suggested_name.utf8() + "\"\n"); |
392 } else { | 393 } else { |
393 delegate_->PrintMessage(std::string("Loading URL externally - \"") + | 394 delegate_->PrintMessage(std::string("Loading URL externally - \"") + |
394 URLDescription(request.url()) + "\"\n"); | 395 URLDescription(request.url()) + "\"\n"); |
395 } | 396 } |
396 delegate_->TestFinished(); | 397 delegate_->TestFinished(); |
397 } | 398 } |
398 } | 399 } |
399 | 400 |
| 401 void WebFrameTestClient::loadErrorPage(int reason) { |
| 402 if (test_runner()->shouldDumpFrameLoadCallbacks()) { |
| 403 delegate_->PrintMessage(base::StringPrintf( |
| 404 "- loadErrorPage: %s\n", net::ErrorToString(reason).c_str())); |
| 405 } |
| 406 } |
| 407 |
400 void WebFrameTestClient::didStartProvisionalLoad(blink::WebLocalFrame* frame, | 408 void WebFrameTestClient::didStartProvisionalLoad(blink::WebLocalFrame* frame, |
401 double trigering_event_time) { | 409 double trigering_event_time) { |
402 test_runner()->tryToSetTopLoadingFrame(frame); | 410 test_runner()->tryToSetTopLoadingFrame(frame); |
403 | 411 |
404 if (test_runner()->shouldDumpFrameLoadCallbacks()) { | 412 if (test_runner()->shouldDumpFrameLoadCallbacks()) { |
405 PrintFrameDescription(delegate_, frame); | 413 PrintFrameDescription(delegate_, frame); |
406 delegate_->PrintMessage(" - didStartProvisionalLoadForFrame\n"); | 414 delegate_->PrintMessage(" - didStartProvisionalLoadForFrame\n"); |
407 } | 415 } |
408 | 416 |
409 if (test_runner()->shouldDumpUserGestureInFrameLoadCallbacks()) { | 417 if (test_runner()->shouldDumpUserGestureInFrameLoadCallbacks()) { |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 blink::WebEffectiveConnectionType | 707 blink::WebEffectiveConnectionType |
700 WebFrameTestClient::getEffectiveConnectionType() { | 708 WebFrameTestClient::getEffectiveConnectionType() { |
701 return test_runner()->effective_connection_type(); | 709 return test_runner()->effective_connection_type(); |
702 } | 710 } |
703 | 711 |
704 TestRunner* WebFrameTestClient::test_runner() { | 712 TestRunner* WebFrameTestClient::test_runner() { |
705 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); | 713 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); |
706 } | 714 } |
707 | 715 |
708 } // namespace test_runner | 716 } // namespace test_runner |
OLD | NEW |