| 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_widget_test_client.h" | 5 #include "components/test_runner/web_widget_test_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "components/test_runner/event_sender.h" |
| 11 #include "components/test_runner/mock_screen_orientation_client.h" | 12 #include "components/test_runner/mock_screen_orientation_client.h" |
| 12 #include "components/test_runner/test_interfaces.h" | 13 #include "components/test_runner/test_interfaces.h" |
| 13 #include "components/test_runner/test_runner.h" | 14 #include "components/test_runner/test_runner.h" |
| 14 #include "components/test_runner/test_runner_for_specific_view.h" | 15 #include "components/test_runner/test_runner_for_specific_view.h" |
| 15 #include "components/test_runner/web_test_delegate.h" | 16 #include "components/test_runner/web_test_delegate.h" |
| 16 #include "components/test_runner/web_view_test_proxy.h" | 17 #include "components/test_runner/web_view_test_proxy.h" |
| 17 #include "components/test_runner/web_widget_test_proxy.h" | 18 #include "components/test_runner/web_widget_test_proxy.h" |
| 18 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 19 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
| 19 #include "third_party/WebKit/public/web/WebPagePopup.h" | 20 #include "third_party/WebKit/public/web/WebPagePopup.h" |
| 20 #include "third_party/WebKit/public/web/WebWidget.h" | 21 #include "third_party/WebKit/public/web/WebWidget.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 96 } |
| 96 | 97 |
| 97 void WebWidgetTestClient::resetInputMethod() { | 98 void WebWidgetTestClient::resetInputMethod() { |
| 98 // If a composition text exists, then we need to let the browser process | 99 // If a composition text exists, then we need to let the browser process |
| 99 // to cancel the input method's ongoing composition session. | 100 // to cancel the input method's ongoing composition session. |
| 100 if (web_widget_test_proxy_base_) | 101 if (web_widget_test_proxy_base_) |
| 101 web_widget_test_proxy_base_->web_widget()->finishComposingText( | 102 web_widget_test_proxy_base_->web_widget()->finishComposingText( |
| 102 blink::WebWidget::KeepSelection); | 103 blink::WebWidget::KeepSelection); |
| 103 } | 104 } |
| 104 | 105 |
| 106 void WebWidgetTestClient::startDragging(blink::WebReferrerPolicy policy, |
| 107 const blink::WebDragData& data, |
| 108 blink::WebDragOperationsMask mask, |
| 109 const blink::WebImage& image, |
| 110 const blink::WebPoint& point) { |
| 111 test_runner()->setDragImage(image); |
| 112 |
| 113 // When running a test, we need to fake a drag drop operation otherwise |
| 114 // Windows waits for real mouse events to know when the drag is over. |
| 115 web_widget_test_proxy_base_->event_sender()->DoDragDrop(data, mask); |
| 116 } |
| 117 |
| 118 |
| 105 TestRunnerForSpecificView* WebWidgetTestClient::view_test_runner() { | 119 TestRunnerForSpecificView* WebWidgetTestClient::view_test_runner() { |
| 106 return web_widget_test_proxy_base_->web_view_test_proxy_base() | 120 return web_widget_test_proxy_base_->web_view_test_proxy_base() |
| 107 ->view_test_runner(); | 121 ->view_test_runner(); |
| 108 } | 122 } |
| 109 | 123 |
| 110 WebTestDelegate* WebWidgetTestClient::delegate() { | 124 WebTestDelegate* WebWidgetTestClient::delegate() { |
| 111 return web_widget_test_proxy_base_->web_view_test_proxy_base()->delegate(); | 125 return web_widget_test_proxy_base_->web_view_test_proxy_base()->delegate(); |
| 112 } | 126 } |
| 113 | 127 |
| 114 TestRunner* WebWidgetTestClient::test_runner() { | 128 TestRunner* WebWidgetTestClient::test_runner() { |
| 115 return web_widget_test_proxy_base_->web_view_test_proxy_base() | 129 return web_widget_test_proxy_base_->web_view_test_proxy_base() |
| 116 ->test_interfaces() | 130 ->test_interfaces() |
| 117 ->GetTestRunner(); | 131 ->GetTestRunner(); |
| 118 } | 132 } |
| 119 | 133 |
| 120 } // namespace test_runner | 134 } // namespace test_runner |
| OLD | NEW |