| 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 f2e37c29eebb31345ed0afe4b296c470b9a13d48..591e12fb2fb9bb811fb2a3bae31a5b8c69cd39f7 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
|
| @@ -188,6 +188,116 @@ public class ImeTest extends ContentShellTestBase {
|
| waitAndVerifyUpdateSelection(10, 8, 8, 2, 6);
|
| }
|
|
|
| + // When newCursorPosition != 1, setComposingText doesn't work for ReplicaInputConnection
|
| + // because there is a bug in BaseInputConnection.
|
| + @CommandLineFlags.Add("enable-features=ImeThread")
|
| + @SmallTest
|
| + @Feature({"TextInput", "Main"})
|
| + public void testSetComposingTextWithEmptyTextForDifferentnewCursorPositions() throws Throwable {
|
| + commitText("hello", 1);
|
| + waitAndVerifyUpdateSelection(0, 5, 5, -1, -1);
|
| +
|
| + // Cursor exceeds the left boundary.
|
| + setComposingText("", -100);
|
| + waitAndVerifyUpdateSelection(1, 0, 0, -1, -1);
|
| +
|
| + // Cursor exceeds the right boundary.
|
| + setComposingText("", 100);
|
| + waitAndVerifyUpdateSelection(2, 5, 5, -1, -1);
|
| +
|
| + // Cursor is on the left boundary.
|
| + setComposingText("", -5);
|
| + waitAndVerifyUpdateSelection(3, 0, 0, -1, -1);
|
| +
|
| + // Cursor is on the right boundary.
|
| + setComposingText("", 6);
|
| + waitAndVerifyUpdateSelection(4, 5, 5, -1, -1);
|
| +
|
| + // Cursor is between the left boundary and the composing text.
|
| + setComposingText("", -3);
|
| + waitAndVerifyUpdateSelection(5, 2, 2, -1, -1);
|
| +
|
| + // Cursor is between the composing text and the right boundary.
|
| + setComposingText("", 2);
|
| + waitAndVerifyUpdateSelection(6, 3, 3, -1, -1);
|
| +
|
| + // Cursor is on the left of composing text.
|
| + // Note that we shouldn't call waitAndVerifyUpdateSelection() because the selection doesn't
|
| + // change.
|
| + setComposingText("", 0);
|
| + assertTextsAroundCursor("hel", "", "lo");
|
| +
|
| + // Cursor is on the right of composing text.
|
| + setComposingText("", 1);
|
| + assertTextsAroundCursor("hel", "", "lo");
|
| + }
|
| +
|
| + // When newCursorPosition != 1, setComposingText doesn't work for ReplicaInputConnection
|
| + // because there is a bug in BaseInputConnection.
|
| + @CommandLineFlags.Add("enable-features=ImeThread")
|
| + @SmallTest
|
| + @Feature({"TextInput", "Main"})
|
| + public void testSetComposingTextWithEmptyTextAndPreviousComposition() throws Throwable {
|
| + commitText("hello", 1);
|
| + waitAndVerifyUpdateSelection(0, 5, 5, -1, -1);
|
| +
|
| + setComposingText("AB", 1);
|
| + waitAndVerifyUpdateSelection(1, 7, 7, 5, 7);
|
| +
|
| + // Cursor exceeds the left boundary.
|
| + setComposingText("", -100);
|
| + waitAndVerifyUpdateSelection(2, 0, 0, -1, -1);
|
| +
|
| + setComposingText("AB", 1);
|
| + waitAndVerifyUpdateSelection(3, 2, 2, 0, 2);
|
| +
|
| + // Cursor exceeds the right boundary.
|
| + setComposingText("", 100);
|
| + waitAndVerifyUpdateSelection(4, 5, 5, -1, -1);
|
| +
|
| + setComposingText("AB", 1);
|
| + waitAndVerifyUpdateSelection(5, 7, 7, 5, 7);
|
| +
|
| + // Cursor is on the left boundary.
|
| + setComposingText("", -5);
|
| + waitAndVerifyUpdateSelection(6, 0, 0, -1, -1);
|
| +
|
| + setComposingText("AB", 1);
|
| + waitAndVerifyUpdateSelection(7, 2, 2, 0, 2);
|
| +
|
| + // Cursor is on the right boundary.
|
| + setComposingText("", 6);
|
| + waitAndVerifyUpdateSelection(8, 5, 5, -1, -1);
|
| +
|
| + setComposingText("AB", 1);
|
| + waitAndVerifyUpdateSelection(9, 7, 7, 5, 7);
|
| +
|
| + // Cursor is between the left boundary and the composing text.
|
| + setComposingText("", -3);
|
| + waitAndVerifyUpdateSelection(10, 2, 2, -1, -1);
|
| +
|
| + setComposingText("AB", 1);
|
| + waitAndVerifyUpdateSelection(11, 4, 4, 2, 4);
|
| +
|
| + // Cursor is between the composing text and the right boundary.
|
| + setComposingText("", 2);
|
| + waitAndVerifyUpdateSelection(12, 3, 3, -1, -1);
|
| +
|
| + setComposingText("AB", 1);
|
| + waitAndVerifyUpdateSelection(13, 5, 5, 3, 5);
|
| +
|
| + // Cursor is on the left of composing text.
|
| + setComposingText("", 0);
|
| + waitAndVerifyUpdateSelection(14, 3, 3, -1, -1);
|
| +
|
| + setComposingText("AB", 1);
|
| + waitAndVerifyUpdateSelection(15, 5, 5, 3, 5);
|
| +
|
| + // Cursor is on the right of composing text.
|
| + setComposingText("", 1);
|
| + waitAndVerifyUpdateSelection(16, 3, 3, -1, -1);
|
| + }
|
| +
|
| @SmallTest
|
| @Feature({"TextInput", "Main"})
|
| public void testCommitWhileComposingText() throws Throwable {
|
|
|