Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Side by Side Diff: components/test_runner/web_widget_test_client.cc

Issue 2333813002: Introduce WebInputMethodController to blink (Closed)
Patch Set: Moved ConfirmCompositionBehavior to WebInputMethodController Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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* frameWidget = nullptr;
lfg 2016/09/16 20:17:09 frame_widget
EhsanK 2016/09/20 15:38:29 Acknowledged.
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 frameWidget = static_cast<blink::WebFrameWidget*>(
114 web_widget_test_proxy_base_->web_widget());
115 } else if (web_view_test_proxy_base_) {
116 blink::WebLocalFrame* mainFrame =
lfg 2016/09/16 20:17:09 main_frame
EhsanK 2016/09/20 15:38:29 Acknowledged.
117 web_view_test_proxy_base_->web_view()->mainFrame()->toWebLocalFrame();
118 DCHECK(mainFrame);
119 frameWidget = mainFrame->frameWidget();
120 }
121
122 if (frameWidget && frameWidget->getActiveWebInputMethodController()) {
123 frameWidget->getActiveWebInputMethodController()->finishComposingText(
108 blink::WebWidget::KeepSelection); 124 blink::WebWidget::KeepSelection);
lfg 2016/09/16 20:17:09 Why this method is implemented using KeepSelection
EhsanK 2016/09/20 15:38:29 The one with DoNotKeepSelection sounds more correc
aelias_OOO_until_Jul13 2016/09/21 08:28:02 This was a mistake, you can change it to DoNotKeep
lfg 2016/09/21 16:56:14 I think we should be able to just remove this over
EhsanK 2016/09/26 20:54:29 The difference would be that here we do not send a
lfg 2016/09/29 14:16:41 I think its worth investigating these failures and
EhsanK 2016/11/01 15:46:04 I dug deeper and here is what I found: In the test
125 }
109 } 126 }
110 127
111 } // namespace test_runner 128 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698