Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java

Issue 1995333002: Handle newCursorPosition correctly for Android's commitText() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add 3 tests Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..62c5b8ba26ff85327a7c0663dfe840fd0bff6f25 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 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 {

Powered by Google App Engine
This is Rietveld 408576698