| 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 std::string("Downloading URL with suggested filename \"") + | 398 std::string("Downloading URL with suggested filename \"") + |
| 398 suggested_name.utf8() + "\"\n"); | 399 suggested_name.utf8() + "\"\n"); |
| 399 } else { | 400 } else { |
| 400 delegate_->PrintMessage(std::string("Loading URL externally - \"") + | 401 delegate_->PrintMessage(std::string("Loading URL externally - \"") + |
| 401 URLDescription(request.url()) + "\"\n"); | 402 URLDescription(request.url()) + "\"\n"); |
| 402 } | 403 } |
| 403 delegate_->TestFinished(); | 404 delegate_->TestFinished(); |
| 404 } | 405 } |
| 405 } | 406 } |
| 406 | 407 |
| 408 void WebFrameTestClient::loadErrorPage(int reason) { |
| 409 if (test_runner()->shouldDumpFrameLoadCallbacks()) { |
| 410 delegate_->PrintMessage(base::StringPrintf( |
| 411 "- loadErrorPage: %s\n", net::ErrorToString(reason).c_str())); |
| 412 } |
| 413 } |
| 414 |
| 407 void WebFrameTestClient::didStartProvisionalLoad(blink::WebLocalFrame* frame) { | 415 void WebFrameTestClient::didStartProvisionalLoad(blink::WebLocalFrame* frame) { |
| 408 test_runner()->tryToSetTopLoadingFrame(frame); | 416 test_runner()->tryToSetTopLoadingFrame(frame); |
| 409 | 417 |
| 410 if (test_runner()->shouldDumpFrameLoadCallbacks()) { | 418 if (test_runner()->shouldDumpFrameLoadCallbacks()) { |
| 411 PrintFrameDescription(delegate_, frame); | 419 PrintFrameDescription(delegate_, frame); |
| 412 delegate_->PrintMessage(" - didStartProvisionalLoadForFrame\n"); | 420 delegate_->PrintMessage(" - didStartProvisionalLoadForFrame\n"); |
| 413 } | 421 } |
| 414 | 422 |
| 415 if (test_runner()->shouldDumpUserGestureInFrameLoadCallbacks()) { | 423 if (test_runner()->shouldDumpUserGestureInFrameLoadCallbacks()) { |
| 416 PrintFrameuserGestureStatus(delegate_, frame, | 424 PrintFrameuserGestureStatus(delegate_, frame, |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 blink::WebEffectiveConnectionType | 713 blink::WebEffectiveConnectionType |
| 706 WebFrameTestClient::getEffectiveConnectionType() { | 714 WebFrameTestClient::getEffectiveConnectionType() { |
| 707 return test_runner()->effective_connection_type(); | 715 return test_runner()->effective_connection_type(); |
| 708 } | 716 } |
| 709 | 717 |
| 710 TestRunner* WebFrameTestClient::test_runner() { | 718 TestRunner* WebFrameTestClient::test_runner() { |
| 711 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); | 719 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); |
| 712 } | 720 } |
| 713 | 721 |
| 714 } // namespace test_runner | 722 } // namespace test_runner |
| OLD | NEW |