OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.content.browser.input; | 5 package org.chromium.content.browser.input; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.ClipData; | 8 import android.content.ClipData; |
9 import android.content.ClipboardManager; | 9 import android.content.ClipboardManager; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); | 200 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); |
201 assertWaitForKeyboardStatus(true); | 201 assertWaitForKeyboardStatus(true); |
202 assertWaitForSelectActionBarStatus(true); | 202 assertWaitForSelectActionBarStatus(true); |
203 DOMUtils.clickNode(this, mContentViewCore, "input_radio"); | 203 DOMUtils.clickNode(this, mContentViewCore, "input_radio"); |
204 assertWaitForKeyboardStatus(false); | 204 assertWaitForKeyboardStatus(false); |
205 assertWaitForSelectActionBarStatus(false); | 205 assertWaitForSelectActionBarStatus(false); |
206 } | 206 } |
207 | 207 |
208 @SmallTest | 208 @SmallTest |
209 @Feature({"TextInput"}) | 209 @Feature({"TextInput"}) |
| 210 public void testImeNotShownOnLongPressingDifferentEmptyInputs() throws Excep
tion { |
| 211 DOMUtils.focusNode(mContentViewCore, "input_radio"); |
| 212 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); |
| 213 assertWaitForKeyboardStatus(false); |
| 214 DOMUtils.longPressNode(this, mContentViewCore, "textarea"); |
| 215 assertWaitForKeyboardStatus(false); |
| 216 } |
| 217 |
| 218 @SmallTest |
| 219 @Feature({"TextInput"}) |
| 220 public void testImeStaysOnLongPressingDifferentNonEmptyInputs() throws Excep
tion { |
| 221 DOMUtils.focusNode(mContentViewCore, "input_text"); |
| 222 assertWaitForKeyboardStatus(true); |
| 223 commitText(mConnection, "Sample Text", 1); |
| 224 DOMUtils.focusNode(mContentViewCore, "textarea"); |
| 225 commitText(mConnection, "Sample Text", 1); |
| 226 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); |
| 227 assertWaitForKeyboardStatus(true); |
| 228 DOMUtils.longPressNode(this, mContentViewCore, "textarea"); |
| 229 assertWaitForKeyboardStatus(true); |
| 230 } |
| 231 |
| 232 @SmallTest |
| 233 @Feature({"TextInput"}) |
210 public void testImeCut() throws Exception { | 234 public void testImeCut() throws Exception { |
211 commitText(mConnection, "snarful", 1); | 235 commitText(mConnection, "snarful", 1); |
212 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "snarful",
7, 7, -1, -1); | 236 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "snarful",
7, 7, -1, -1); |
213 | 237 |
214 setSelection(mConnection, 1, 5); | 238 setSelection(mConnection, 1, 5); |
215 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "snarful",
1, 5, -1, -1); | 239 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "snarful",
1, 5, -1, -1); |
216 | 240 |
217 cut(mImeAdapter); | 241 cut(mImeAdapter); |
218 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 3, "sul", 1,
1, -1, -1); | 242 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 3, "sul", 1,
1, -1, -1); |
219 | 243 |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 public void assertEqualState(String text, int selectionStart, int select
ionEnd, | 859 public void assertEqualState(String text, int selectionStart, int select
ionEnd, |
836 int compositionStart, int compositionEnd) { | 860 int compositionStart, int compositionEnd) { |
837 assertEquals("Text did not match", text, mText); | 861 assertEquals("Text did not match", text, mText); |
838 assertEquals("Selection start did not match", selectionStart, mSelec
tionStart); | 862 assertEquals("Selection start did not match", selectionStart, mSelec
tionStart); |
839 assertEquals("Selection end did not match", selectionEnd, mSelection
End); | 863 assertEquals("Selection end did not match", selectionEnd, mSelection
End); |
840 assertEquals("Composition start did not match", compositionStart, mC
ompositionStart); | 864 assertEquals("Composition start did not match", compositionStart, mC
ompositionStart); |
841 assertEquals("Composition end did not match", compositionEnd, mCompo
sitionEnd); | 865 assertEquals("Composition end did not match", compositionEnd, mCompo
sitionEnd); |
842 } | 866 } |
843 } | 867 } |
844 } | 868 } |
OLD | NEW |