| 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 "third_party/WebKit/public/platform/WebString.h" | 26 #include "third_party/WebKit/public/platform/WebString.h" |
| 26 #include "third_party/WebKit/public/platform/WebURL.h" | 27 #include "third_party/WebKit/public/platform/WebURL.h" |
| 27 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 28 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 28 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 29 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 29 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 30 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
| 30 #include "third_party/WebKit/public/web/WebElement.h" | 31 #include "third_party/WebKit/public/web/WebElement.h" |
| 31 #include "third_party/WebKit/public/web/WebFrame.h" | 32 #include "third_party/WebKit/public/web/WebFrame.h" |
| 32 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 33 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 33 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 34 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
| 34 #include "third_party/WebKit/public/web/WebPluginParams.h" | 35 #include "third_party/WebKit/public/web/WebPluginParams.h" |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 blink::WebPlugin* WebFrameTestClient::createPlugin( | 363 blink::WebPlugin* WebFrameTestClient::createPlugin( |
| 363 blink::WebLocalFrame* frame, | 364 blink::WebLocalFrame* frame, |
| 364 const blink::WebPluginParams& params) { | 365 const blink::WebPluginParams& params) { |
| 365 if (TestPlugin::IsSupportedMimeType(params.mimeType)) | 366 if (TestPlugin::IsSupportedMimeType(params.mimeType)) |
| 366 return TestPlugin::create(frame, params, delegate_); | 367 return TestPlugin::create(frame, params, delegate_); |
| 367 return delegate_->CreatePluginPlaceholder(frame, params); | 368 return delegate_->CreatePluginPlaceholder(frame, params); |
| 368 } | 369 } |
| 369 | 370 |
| 370 void WebFrameTestClient::showContextMenu( | 371 void WebFrameTestClient::showContextMenu( |
| 371 const blink::WebContextMenuData& context_menu_data) { | 372 const blink::WebContextMenuData& context_menu_data) { |
| 372 web_view_test_proxy_base_->event_sender()->SetContextMenuData( | 373 delegate_->GetWebWidgetTestProxyBase(web_frame_test_proxy_base_->web_frame()) |
| 373 context_menu_data); | 374 ->event_sender() |
| 375 ->SetContextMenuData(context_menu_data); |
| 374 } | 376 } |
| 375 | 377 |
| 376 blink::WebUserMediaClient* WebFrameTestClient::userMediaClient() { | 378 blink::WebUserMediaClient* WebFrameTestClient::userMediaClient() { |
| 377 return test_runner()->getMockWebUserMediaClient(); | 379 return test_runner()->getMockWebUserMediaClient(); |
| 378 } | 380 } |
| 379 | 381 |
| 380 void WebFrameTestClient::loadURLExternally( | 382 void WebFrameTestClient::loadURLExternally( |
| 381 const blink::WebURLRequest& request, | 383 const blink::WebURLRequest& request, |
| 382 blink::WebNavigationPolicy policy, | 384 blink::WebNavigationPolicy policy, |
| 383 const blink::WebString& suggested_name, | 385 const blink::WebString& suggested_name, |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 callback->onSuccess(); | 678 callback->onSuccess(); |
| 677 else if (device_id == "unauthorized") | 679 else if (device_id == "unauthorized") |
| 678 callback->onError(blink::WebSetSinkIdError::NotAuthorized); | 680 callback->onError(blink::WebSetSinkIdError::NotAuthorized); |
| 679 else | 681 else |
| 680 callback->onError(blink::WebSetSinkIdError::NotFound); | 682 callback->onError(blink::WebSetSinkIdError::NotFound); |
| 681 } | 683 } |
| 682 | 684 |
| 683 void WebFrameTestClient::didClearWindowObject(blink::WebLocalFrame* frame) { | 685 void WebFrameTestClient::didClearWindowObject(blink::WebLocalFrame* frame) { |
| 684 web_view_test_proxy_base_->test_interfaces()->BindTo(frame); | 686 web_view_test_proxy_base_->test_interfaces()->BindTo(frame); |
| 685 web_view_test_proxy_base_->BindTo(frame); | 687 web_view_test_proxy_base_->BindTo(frame); |
| 688 delegate_->GetWebWidgetTestProxyBase(frame)->BindTo(frame); |
| 686 } | 689 } |
| 687 | 690 |
| 688 bool WebFrameTestClient::runFileChooser( | 691 bool WebFrameTestClient::runFileChooser( |
| 689 const blink::WebFileChooserParams& params, | 692 const blink::WebFileChooserParams& params, |
| 690 blink::WebFileChooserCompletion* completion) { | 693 blink::WebFileChooserCompletion* completion) { |
| 691 delegate_->PrintMessage("Mock: Opening a file chooser.\n"); | 694 delegate_->PrintMessage("Mock: Opening a file chooser.\n"); |
| 692 // FIXME: Add ability to set file names to a file upload control. | 695 // FIXME: Add ability to set file names to a file upload control. |
| 693 return false; | 696 return false; |
| 694 } | 697 } |
| 695 | 698 |
| 696 blink::WebEffectiveConnectionType | 699 blink::WebEffectiveConnectionType |
| 697 WebFrameTestClient::getEffectiveConnectionType() { | 700 WebFrameTestClient::getEffectiveConnectionType() { |
| 698 return test_runner()->effective_connection_type(); | 701 return test_runner()->effective_connection_type(); |
| 699 } | 702 } |
| 700 | 703 |
| 701 TestRunner* WebFrameTestClient::test_runner() { | 704 TestRunner* WebFrameTestClient::test_runner() { |
| 702 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); | 705 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); |
| 703 } | 706 } |
| 704 | 707 |
| 705 } // namespace test_runner | 708 } // namespace test_runner |
| OLD | NEW |