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