Chromium Code Reviews| Index: content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java |
| diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java |
| index d8c1eafd3d0bd5bfcd57611609f6201e431798f5..5a97b5e6891c80860a06c19448c5254d7e73f5a4 100644 |
| --- a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java |
| +++ b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java |
| @@ -104,6 +104,44 @@ public class ImeTest extends ContentShellTestBase { |
| resetAllStates(); |
| } |
| + @SmallTest |
| + @Feature({"TextInput", "Main"}) |
| + public void testSetComposingTextForDifferentnewCursorPositions() throws Throwable { |
| + // When newCursorPosition != 1, setComposingText doesn't work for ReplicaInputConnection |
| + // because there is a bug in BaseInputConnection. |
| + if (!usingReplicaInputConnection()) { |
| + // Cursor is on the right of composing text when newCursorPosition > 0 |
| + setComposingText("ab", 1); |
| + waitAndVerifyUpdateSelection(0, 2, 2, 0, 2); |
| + |
| + finishComposingText(); |
| + waitAndVerifyUpdateSelection(1, 2, 2, -1, -1); |
| + |
| + // Cursor is on the left of composing text when newCursorPosition <= 0 |
| + setComposingText("cd", 0); |
| + waitAndVerifyUpdateSelection(2, 2, 2, 2, 4); |
| + |
| + // Cursor is on the left boundary |
|
Changwan Ryu
2016/04/07 11:46:19
for the completeness of tests, could you also add
|
| + setComposingText("cd", -2); |
| + waitAndVerifyUpdateSelection(3, 0, 0, 2, 4); |
| + |
| + // Cursor exceeds the left boundary |
| + setComposingText("cdef", -10); |
| + waitAndVerifyUpdateSelection(4, 0, 0, 2, 6); |
| + |
| + finishComposingText(); |
| + waitAndVerifyUpdateSelection(5, 0, 0, -1, -1); |
| + |
| + // Cursor is on the right boundary |
|
Changwan Ryu
2016/04/07 11:46:18
ditto
|
| + setComposingText("gh", 7); |
| + waitAndVerifyUpdateSelection(6, 8, 8, 0, 2); |
| + |
| + // Cursor exceeds the right boundary |
| + setComposingText("ghij", 20); |
| + waitAndVerifyUpdateSelection(7, 10, 10, 0, 4); |
| + } |
| + } |
| + |
| @MediumTest |
| @Feature({"TextInput", "Main"}) |
| public void testKeyboardDismissedAfterClickingGo() throws Throwable { |