| 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/mock_screen_orientation_client.h" | 11 #include "components/test_runner/mock_screen_orientation_client.h" |
| 12 #include "components/test_runner/test_interfaces.h" | 12 #include "components/test_runner/test_interfaces.h" |
| 13 #include "components/test_runner/test_runner.h" | 13 #include "components/test_runner/test_runner.h" |
| 14 #include "components/test_runner/test_runner_for_specific_view.h" | 14 #include "components/test_runner/test_runner_for_specific_view.h" |
| 15 #include "components/test_runner/web_test_delegate.h" | 15 #include "components/test_runner/web_test_delegate.h" |
| 16 #include "components/test_runner/web_view_test_proxy.h" | 16 #include "components/test_runner/web_view_test_proxy.h" |
| 17 #include "components/test_runner/web_widget_test_proxy.h" | 17 #include "components/test_runner/web_widget_test_proxy.h" |
| 18 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 18 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
| 19 #include "third_party/WebKit/public/web/WebFrameWidget.h" |
| 20 #include "third_party/WebKit/public/web/WebInputMethodController.h" |
| 21 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 19 #include "third_party/WebKit/public/web/WebPagePopup.h" | 22 #include "third_party/WebKit/public/web/WebPagePopup.h" |
| 23 #include "third_party/WebKit/public/web/WebView.h" |
| 20 #include "third_party/WebKit/public/web/WebWidget.h" | 24 #include "third_party/WebKit/public/web/WebWidget.h" |
| 21 | 25 |
| 22 namespace test_runner { | 26 namespace test_runner { |
| 23 | 27 |
| 24 WebWidgetTestClient::WebWidgetTestClient( | 28 WebWidgetTestClient::WebWidgetTestClient( |
| 25 WebWidgetTestProxyBase* web_widget_test_proxy_base) | 29 WebWidgetTestProxyBase* web_widget_test_proxy_base) |
| 26 : web_widget_test_proxy_base_(web_widget_test_proxy_base), | 30 : web_widget_test_proxy_base_(web_widget_test_proxy_base), |
| 27 animation_scheduled_(false), | 31 animation_scheduled_(false), |
| 28 weak_factory_(this) { | 32 weak_factory_(this) { |
| 29 DCHECK(web_widget_test_proxy_base_); | 33 DCHECK(web_widget_test_proxy_base_); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 91 |
| 88 bool WebWidgetTestClient::isPointerLocked() { | 92 bool WebWidgetTestClient::isPointerLocked() { |
| 89 return view_test_runner()->isPointerLocked(); | 93 return view_test_runner()->isPointerLocked(); |
| 90 } | 94 } |
| 91 | 95 |
| 92 void WebWidgetTestClient::setToolTipText(const blink::WebString& text, | 96 void WebWidgetTestClient::setToolTipText(const blink::WebString& text, |
| 93 blink::WebTextDirection direction) { | 97 blink::WebTextDirection direction) { |
| 94 test_runner()->setToolTipText(text); | 98 test_runner()->setToolTipText(text); |
| 95 } | 99 } |
| 96 | 100 |
| 97 void WebWidgetTestClient::resetInputMethod() { | |
| 98 // If a composition text exists, then we need to let the browser process | |
| 99 // to cancel the input method's ongoing composition session. | |
| 100 if (web_widget_test_proxy_base_) | |
| 101 web_widget_test_proxy_base_->web_widget()->finishComposingText( | |
| 102 blink::WebWidget::KeepSelection); | |
| 103 } | |
| 104 | |
| 105 TestRunnerForSpecificView* WebWidgetTestClient::view_test_runner() { | 101 TestRunnerForSpecificView* WebWidgetTestClient::view_test_runner() { |
| 106 return web_widget_test_proxy_base_->web_view_test_proxy_base() | 102 return web_widget_test_proxy_base_->web_view_test_proxy_base() |
| 107 ->view_test_runner(); | 103 ->view_test_runner(); |
| 108 } | 104 } |
| 109 | 105 |
| 110 WebTestDelegate* WebWidgetTestClient::delegate() { | 106 WebTestDelegate* WebWidgetTestClient::delegate() { |
| 111 return web_widget_test_proxy_base_->web_view_test_proxy_base()->delegate(); | 107 return web_widget_test_proxy_base_->web_view_test_proxy_base()->delegate(); |
| 112 } | 108 } |
| 113 | 109 |
| 114 TestRunner* WebWidgetTestClient::test_runner() { | 110 TestRunner* WebWidgetTestClient::test_runner() { |
| 115 return web_widget_test_proxy_base_->web_view_test_proxy_base() | 111 return web_widget_test_proxy_base_->web_view_test_proxy_base() |
| 116 ->test_interfaces() | 112 ->test_interfaces() |
| 117 ->GetTestRunner(); | 113 ->GetTestRunner(); |
| 118 } | 114 } |
| 119 | 115 |
| 120 } // namespace test_runner | 116 } // namespace test_runner |
| OLD | NEW |