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

Side by Side Diff: android_webview/javatests/src/org/chromium/android_webview/test/AwImeTest.java

Issue 2290133002: Make WebView keep keyboard when losing focus (Closed)
Patch Set: Add some tests 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 package org.chromium.android_webview.test; 5 package org.chromium.android_webview.test;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.test.suitebuilder.annotation.SmallTest; 8 import android.test.suitebuilder.annotation.SmallTest;
9 import android.view.inputmethod.InputConnection; 9 import android.view.inputmethod.InputConnection;
10 import android.view.inputmethod.InputMethodManager; 10 import android.view.inputmethod.InputMethodManager;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 + "(function() {\n" 105 + "(function() {\n"
106 + "if (document.hasFocus()) {\n" 106 + "if (document.hasFocus()) {\n"
107 + " onDocumentFocused();" 107 + " onDocumentFocused();"
108 + "} else {\n" 108 + "} else {\n"
109 + " window.addEventListener('focus', onDocumentFocused);\n" 109 + " window.addEventListener('focus', onDocumentFocused);\n"
110 + "}})();"); 110 + "}})();");
111 mTestJavascriptInterface.getFocusCallbackHelper().waitForCallback(0); 111 mTestJavascriptInterface.getFocusCallbackHelper().waitForCallback(0);
112 } 112 }
113 113
114 private void waitForNonNullInputConnection() throws InterruptedException { 114 private void waitForNonNullInputConnection() throws InterruptedException {
115 CriteriaHelper.pollUiThread(new Criteria() { 115 CriteriaHelper.pollUiThread(new Criteria() {
Changwan Ryu 2016/09/09 01:07:29 FYI, this test is based on CriteriaHelper, and is
yabinh 2016/10/18 08:57:49 When we use CallbackHelper, we expect it should se
116 @Override 116 @Override
117 public boolean isSatisfied() { 117 public boolean isSatisfied() {
118 InputConnection inputConnection = mTestContainerView.getContentV iewCore() 118 InputConnection inputConnection = mTestContainerView.getContentV iewCore()
119 .getImeAdapterForTest().getInputConnectionForTest(); 119 .getImeAdapterForTest().getInputConnectionForTest();
120 return inputConnection != null; 120 return inputConnection != null;
121 } 121 }
122 }); 122 });
123 } 123 }
124 124
125 /** 125 /**
126 * Tests that moving from EditText to WebView keeps the keyboard showing. 126 * Tests that moving from EditText to WebView keeps the keyboard showing.
127 */ 127 */
128 // https://crbug.com/569556 128 // https://crbug.com/569556
129 @SmallTest 129 @SmallTest
130 @Feature({"AndroidWebView", "TextInput"}) 130 @Feature({"AndroidWebView", "TextInput"})
131 public void testPressNextFromEditTextAndType() throws Throwable { 131 public void testPressNextFromEditTextAndType() throws Throwable {
132 loadContentEditableBody(); 132 loadContentEditableBody();
133 focusOnEditTextAndShowKeyboard(); 133 focusOnEditTextAndShowKeyboard();
134 focusOnWebViewAndEnableEditing(); 134 focusOnWebViewAndEnableEditing();
135 waitForNonNullInputConnection(); 135 waitForNonNullInputConnection();
136 } 136 }
137
138 /**
139 * Tests that moving from WebView to EditText keeps the keyboard showing.
140 */
141 // https://crbug.com/636237
142 @SmallTest
143 @Feature({"AndroidWebView", "TextInput"})
144 public void testMoveFromWebViewtoEditText() throws Throwable {
145 loadContentEditableBody();
146 focusOnWebViewAndEnableEditing();
147 waitForNonNullInputConnection();
148
149 focusOnEditTextAndShowKeyboard();
150 waitForNonNullInputConnection();
151 }
137 } 152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698