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

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

Issue 2010803005: Add events tests for inputText in IME test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync, try again Created 4 years, 6 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 | « no previous file | content/test/data/android/input/input_forms.html » ('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 2ba6be7e61ff2a3fd5dc07dc1e6adc7145328aa5..25bcb20db9dd00e3ab8fb0c6771741813a1028ee 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
@@ -91,6 +91,9 @@ public class ImeTest extends ContentShellTestBase {
assertEquals(0, mConnectionFactory.getOutAttrs().initialSelStart);
assertEquals(0, mConnectionFactory.getOutAttrs().initialSelEnd);
+ waitForEventLogs("selectionchange");
+ clearEventLogs();
+
resetAllStates();
}
@@ -1119,6 +1122,24 @@ public class ImeTest extends ContentShellTestBase {
@Feature({"TextInput"})
public void testContentEditableEvents_SetComposingText() throws Throwable {
focusElementAndWaitForStateUpdate("contenteditable_event");
+ waitForEventLogs("selectionchange,selectionchange");
+ clearEventLogs();
+
+ beginBatchEdit();
+ setComposingText("a", 1);
+ finishComposingText();
+ endBatchEdit();
+ waitAndVerifyUpdateSelection(0, 1, 1, -1, -1);
+
+ // TODO(changwan): reduce the number of selection changes
+ waitForEventLogs("keydown(229),compositionstart(),compositionupdate(a),input,keyup(229),"
+ + "compositionupdate(a),input,compositionend(a),selectionchange,selectionchange,"
+ + "selectionchange,selectionchange,selectionchange");
+ }
+
+ @MediumTest
+ @Feature({"TextInput"})
+ public void testInputTextEvents_SetComposingText() throws Throwable {
beginBatchEdit();
setComposingText("a", 1);
finishComposingText();
@@ -1126,9 +1147,8 @@ public class ImeTest extends ContentShellTestBase {
waitAndVerifyUpdateSelection(0, 1, 1, -1, -1);
// TODO(changwan): reduce the number of selection changes
- waitForEventLogs("selectionchange,selectionchange,selectionchange,"
- + "keydown(229),compositionstart(),compositionupdate(a),input,"
- + "keyup(229),compositionupdate(a),input,compositionend(a),selectionchange,"
+ waitForEventLogs("keydown(229),compositionstart(),compositionupdate(a),"
+ + "input,keyup(229),compositionupdate(a),input,compositionend(a),selectionchange,"
+ "selectionchange,selectionchange,selectionchange,selectionchange");
}
@@ -1136,15 +1156,63 @@ public class ImeTest extends ContentShellTestBase {
@Feature({"TextInput"})
public void testContentEditableEvents_CommitText() throws Throwable {
focusElementAndWaitForStateUpdate("contenteditable_event");
+ waitForEventLogs("selectionchange,selectionchange");
+ clearEventLogs();
+
commitText("a", 1);
waitAndVerifyUpdateSelection(0, 1, 1, -1, -1);
- // TODO(changwan): reduce the number of selection changes
- waitForEventLogs("selectionchange,selectionchange,selectionchange,keydown(229),input,"
- + "keyup(229),selectionchange");
+ waitForEventLogs("keydown(229),input,keyup(229),selectionchange");
+ }
+
+ @MediumTest
+ @Feature({"TextInput"})
+ public void testInputTextEvents_CommitText() throws Throwable {
+ commitText("a", 1);
+ waitAndVerifyUpdateSelection(0, 1, 1, -1, -1);
+
+ waitForEventLogs("keydown(229),input,keyup(229),selectionchange");
+ }
+
+ @MediumTest
+ @Feature({"TextInput"})
+ public void testContentEditableEvents_DeleteSurroundingText() throws Throwable {
+ focusElementAndWaitForStateUpdate("contenteditable_event");
+ waitForEventLogs("selectionchange,selectionchange");
+ clearEventLogs();
+
+ commitText("a", 1);
+ waitAndVerifyUpdateSelection(0, 1, 1, -1, -1);
+ waitForEventLogs("keydown(229),input,keyup(229),selectionchange");
+ clearEventLogs();
+
+ deleteSurroundingText(1, 0);
+ waitAndVerifyUpdateSelection(1, 0, 0, -1, -1);
+
+ waitForEventLogs("keydown(229),input,keyup(229),selectionchange,selectionchange");
+ }
+
+ @MediumTest
+ @Feature({"TextInput"})
+ public void testInputTextEvents_DeleteSurroundingText() throws Throwable {
+ commitText("a", 1);
+ waitAndVerifyUpdateSelection(0, 1, 1, -1, -1);
+ waitForEventLogs("keydown(229),input,keyup(229),selectionchange");
+ clearEventLogs();
+
+ deleteSurroundingText(1, 0);
+ waitAndVerifyUpdateSelection(1, 0, 0, -1, -1);
+
+ waitForEventLogs("keydown(229),input,keyup(229),selectionchange,selectionchange");
+ }
+
+ private void clearEventLogs() throws Exception {
+ final String code = "clearEventLogs()";
+ JavaScriptUtils.executeJavaScriptAndWaitForResult(
+ getContentViewCore().getWebContents(), code);
}
- private void waitForEventLogs(String expectedLogs) throws Throwable {
+ private void waitForEventLogs(String expectedLogs) throws Exception {
final String code = "getEventLogs()";
final String sanitizedExpectedLogs = "\"" + expectedLogs + "\"";
if (usingReplicaInputConnection()) {
« no previous file with comments | « no previous file | content/test/data/android/input/input_forms.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698