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 72f80f31896040ee17ff4a8612979f92c5ac1fd2..9cb64ea2abc074f769f1a0d784ca850243d90747 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,45 @@ public class ImeTest extends ContentShellTestBase { |
waitAndVerifyUpdateSelection(10, 8, 8, 2, 6); |
} |
+ // When newCursorPosition != 1, commitText doesn't work for ReplicaInputConnection |
+ // because there is a bug in BaseInputConnection. |
+ @CommandLineFlags.Add("enable-features=ImeThread") |
+ @SmallTest |
+ @Feature({"TextInput", "Main"}) |
+ public void testCommitTextForDifferentnewCursorPositions() throws Throwable { |
+ // Cursor is on the left of composing text. |
+ commitText("ab", 0); |
+ waitAndVerifyUpdateSelection(0, 0, 0, -1, -1); |
+ |
+ // Cursor is on the right of committing text. |
+ commitText("cd", 1); |
+ waitAndVerifyUpdateSelection(1, 2, 2, -1, -1); |
+ |
+ // Cursor is between the committing text and the right boundary. |
+ commitText("ef", 2); |
+ waitAndVerifyUpdateSelection(2, 5, 5, -1, -1); |
+ |
+ // Cursor is between the left boundary and the committing text. |
+ commitText("gh", -3); |
+ waitAndVerifyUpdateSelection(3, 2, 2, -1, -1); |
+ |
+ // Cursor is on the right boundary. |
+ commitText("ij", 7); |
+ waitAndVerifyUpdateSelection(4, 10, 10, -1, -1); |
+ |
+ // Cursor is on the left boundary. |
+ commitText("kl", -10); |
+ waitAndVerifyUpdateSelection(5, 0, 0, -1, -1); |
+ |
+ // Cursor exceeds the right boundary. |
+ commitText("mn", 100); |
+ waitAndVerifyUpdateSelection(6, 14, 14, -1, -1); |
+ |
+ // Cursor exceeds the left boundary. |
+ commitText("op", -100); |
+ waitAndVerifyUpdateSelection(7, 0, 0, -1, -1); |
+ } |
+ |
@SmallTest |
@Feature({"TextInput", "Main"}) |
public void testSetComposingTextWithEmptyText() throws Throwable { |