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 db6e026794d88bfafb9dd51db767c6b6f8713d77..aabe2f0d31b59143f9226ba1dc835c33c9d3877a 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 |
@@ -144,7 +144,7 @@ public class ImeTest extends ContentShellTestBase { |
@CommandLineFlags.Add("enable-features=ImeThread") |
@SmallTest |
@Feature({"TextInput", "Main"}) |
- public void testSetComposingTextForDifferentnewCursorPositions() throws Throwable { |
+ public void testSetComposingTextForNewCursorPositions() throws Throwable { |
// Cursor is on the right of composing text when newCursorPosition > 0. |
setComposingText("ab", 1); |
waitAndVerifyUpdateSelection(0, 2, 2, 0, 2); |
@@ -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 testCommitTextForNewCursorPositions() throws Throwable { |
+ // Cursor is on the left of committing 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 { |