| 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_task.h" | 15 #include "components/test_runner/web_task.h" |
| 16 #include "components/test_runner/web_test_delegate.h" | 16 #include "components/test_runner/web_test_delegate.h" |
| 17 #include "components/test_runner/web_view_test_proxy.h" | 17 #include "components/test_runner/web_view_test_proxy.h" |
| 18 #include "components/test_runner/web_widget_test_proxy.h" | 18 #include "components/test_runner/web_widget_test_proxy.h" |
| 19 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 19 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
| 20 #include "third_party/WebKit/public/web/WebFrameWidget.h" |
| 21 #include "third_party/WebKit/public/web/WebInputMethodController.h" |
| 22 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 20 #include "third_party/WebKit/public/web/WebPagePopup.h" | 23 #include "third_party/WebKit/public/web/WebPagePopup.h" |
| 24 #include "third_party/WebKit/public/web/WebView.h" |
| 21 #include "third_party/WebKit/public/web/WebWidget.h" | 25 #include "third_party/WebKit/public/web/WebWidget.h" |
| 22 | 26 |
| 23 namespace test_runner { | 27 namespace test_runner { |
| 24 | 28 |
| 25 WebWidgetTestClient::WebWidgetTestClient( | 29 WebWidgetTestClient::WebWidgetTestClient( |
| 26 TestRunner* test_runner, | 30 TestRunner* test_runner, |
| 27 WebWidgetTestProxyBase* web_widget_test_proxy_base) | 31 WebWidgetTestProxyBase* web_widget_test_proxy_base) |
| 28 : test_runner_(test_runner), | 32 : test_runner_(test_runner), |
| 29 web_view_test_proxy_base_(nullptr), | 33 web_view_test_proxy_base_(nullptr), |
| 30 web_widget_test_proxy_base_(web_widget_test_proxy_base), | 34 web_widget_test_proxy_base_(web_widget_test_proxy_base), |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 100 } |
| 97 | 101 |
| 98 void WebWidgetTestClient::setToolTipText(const blink::WebString& text, | 102 void WebWidgetTestClient::setToolTipText(const blink::WebString& text, |
| 99 blink::WebTextDirection direction) { | 103 blink::WebTextDirection direction) { |
| 100 test_runner_->setToolTipText(text); | 104 test_runner_->setToolTipText(text); |
| 101 } | 105 } |
| 102 | 106 |
| 103 void WebWidgetTestClient::resetInputMethod() { | 107 void WebWidgetTestClient::resetInputMethod() { |
| 104 // If a composition text exists, then we need to let the browser process | 108 // If a composition text exists, then we need to let the browser process |
| 105 // to cancel the input method's ongoing composition session. | 109 // to cancel the input method's ongoing composition session. |
| 106 if (web_widget_test_proxy_base_) | 110 blink::WebFrameWidget* frame_widget = nullptr; |
| 107 web_widget_test_proxy_base_->web_widget()->finishComposingText( | 111 if (web_widget_test_proxy_base_ && |
| 112 web_widget_test_proxy_base_->web_widget()->isWebFrameWidget()) { |
| 113 frame_widget = static_cast<blink::WebFrameWidget*>( |
| 114 web_widget_test_proxy_base_->web_widget()); |
| 115 } else if (web_view_test_proxy_base_) { |
| 116 blink::WebLocalFrame* main_frame = |
| 117 web_view_test_proxy_base_->web_view()->mainFrame()->toWebLocalFrame(); |
| 118 DCHECK(main_frame); |
| 119 frame_widget = mainFrame->frameWidget(); |
| 120 } |
| 121 |
| 122 if (frame_widget && frame_widget->getActiveWebInputMethodController()) { |
| 123 frame_widget->getActiveWebInputMethodController()->finishComposingText( |
| 108 blink::WebWidget::KeepSelection); | 124 blink::WebWidget::KeepSelection); |
| 125 } |
| 109 } | 126 } |
| 110 | 127 |
| 111 } // namespace test_runner | 128 } // namespace test_runner |
| OLD | NEW |