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

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

Issue 1889053003: Fix InputConnection.deleteSurroundingText() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change back to patch set #25 Created 4 years, 2 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
« no previous file with comments | « content/common/input_messages.h ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 80faa598a74dbc6fd42a60e772edc2964916ba1f..2a291da58e984a35208a740a9f7557a100107000 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
@@ -160,19 +160,50 @@ public class ImeTest extends ContentShellTestBase {
@SmallTest
@Feature({"TextInput", "Main"})
@RetryOnFailure
- public void testDeleteSurroundingTextWithZeroValue() throws Throwable {
+ public void testDeleteSurroundingTextWithRangeSelection() throws Throwable {
commitText("hello", 1);
waitAndVerifyUpdateSelection(0, 5, 5, -1, -1);
- deleteSurroundingText(0, 0);
- setSelection(0, 0);
- waitAndVerifyUpdateSelection(1, 0, 0, -1, -1);
+ setSelection(1, 4);
+ waitAndVerifyUpdateSelection(1, 1, 4, -1, -1);
+
deleteSurroundingText(0, 0);
+ assertTextsAroundCursor("h", "ell", "o");
+
+ deleteSurroundingText(1, 1);
+ assertTextsAroundCursor("", "ell", "");
+
+ deleteSurroundingText(1, 0);
+ assertTextsAroundCursor("", "ell", "");
+
+ deleteSurroundingText(0, 1);
+ assertTextsAroundCursor("", "ell", "");
+ }
+
+ @SmallTest
+ @Feature({"TextInput", "Main"})
+ @RetryOnFailure
+ public void testDeleteSurroundingTextWithCursorSelection() throws Throwable {
+ commitText("hello", 1);
+ waitAndVerifyUpdateSelection(0, 5, 5, -1, -1);
setSelection(2, 2);
- waitAndVerifyUpdateSelection(2, 2, 2, -1, -1);
+ waitAndVerifyUpdateSelection(1, 2, 2, -1, -1);
+
deleteSurroundingText(0, 0);
assertTextsAroundCursor("he", null, "llo");
+
+ deleteSurroundingText(1, 1);
+ assertTextsAroundCursor("h", null, "lo");
+
+ deleteSurroundingText(1, 0);
+ assertTextsAroundCursor("", null, "lo");
+
+ deleteSurroundingText(0, 10);
+ assertTextsAroundCursor("", null, "");
+
+ deleteSurroundingText(10, 10);
+ assertTextsAroundCursor("", null, "");
}
@SmallTest
@@ -1370,30 +1401,42 @@ public class ImeTest extends ContentShellTestBase {
waitForEventLogs("selectionchange,selectionchange");
clearEventLogs();
- commitText("a", 1);
- waitAndVerifyUpdateSelection(0, 1, 1, -1, -1);
+ commitText("hello", 1);
+ waitAndVerifyUpdateSelection(0, 5, 5, -1, -1);
waitForEventLogs("keydown(229),input,keyup(229),selectionchange");
clearEventLogs();
- deleteSurroundingText(1, 0);
- waitAndVerifyUpdateSelection(1, 0, 0, -1, -1);
+ setSelection(2, 2);
+ waitAndVerifyUpdateSelection(1, 2, 2, -1, -1);
+ waitForEventLogs("selectionchange");
+ clearEventLogs();
- waitForEventLogs("keydown(229),input,keyup(229),selectionchange,selectionchange");
+ deleteSurroundingText(1, 1);
+ waitAndVerifyUpdateSelection(2, 1, 1, -1, -1);
+ // TODO(yabinh): It should only fire 1 input and 1 selectionchange events.
+ waitForEventLogs("keydown(229),input,input,keyup(229),selectionchange,selectionchange,"
+ + "selectionchange,selectionchange");
}
@MediumTest
@Feature({"TextInput"})
@RetryOnFailure
public void testInputTextEvents_DeleteSurroundingText() throws Throwable {
- commitText("a", 1);
- waitAndVerifyUpdateSelection(0, 1, 1, -1, -1);
+ commitText("hello", 1);
+ waitAndVerifyUpdateSelection(0, 5, 5, -1, -1);
waitForEventLogs("keydown(229),input,keyup(229),selectionchange");
clearEventLogs();
- deleteSurroundingText(1, 0);
- waitAndVerifyUpdateSelection(1, 0, 0, -1, -1);
+ setSelection(2, 2);
+ waitAndVerifyUpdateSelection(1, 2, 2, -1, -1);
+ waitForEventLogs("selectionchange");
+ clearEventLogs();
- waitForEventLogs("keydown(229),input,keyup(229),selectionchange,selectionchange");
+ deleteSurroundingText(1, 1);
+ waitAndVerifyUpdateSelection(2, 1, 1, -1, -1);
+ // TODO(yabinh): It should only fire 1 input and 1 selectionchange events.
+ waitForEventLogs("keydown(229),input,input,keyup(229),selectionchange,selectionchange,"
+ + "selectionchange,selectionchange");
}
@MediumTest
« no previous file with comments | « content/common/input_messages.h ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698