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

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: fix a typo in input_forms.html and clear redundant event logs Created 4 years, 7 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 f2e37c29eebb31345ed0afe4b296c470b9a13d48..7346f524743c704433bf19afccf455124aedf3ba 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
@@ -79,6 +79,8 @@ public class ImeTest extends ContentShellTestBase {
DOMUtils.clickNode(this, mContentViewCore, "input_text");
assertWaitForKeyboardStatus(true);
+ clearEventLogs();
Changwan Ryu 2016/05/27 01:46:15 This is likely to cause flakiness. Sometimes logs
yabinh 2016/05/27 04:44:19 Acknowledged.
+
mConnection = getInputConnection();
mImeAdapter = getImeAdapter();
@@ -1118,6 +1120,23 @@ public class ImeTest extends ContentShellTestBase {
@Feature({"TextInput"})
public void testContentEditableEvents_SetComposingText() throws Throwable {
focusElementAndWaitForStateUpdate("contenteditable_event");
+ clearEventLogs();
Changwan Ryu 2016/05/27 01:46:15 ditto
+
+ 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();
@@ -1125,9 +1144,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");
}
@@ -1135,12 +1153,50 @@ public class ImeTest extends ContentShellTestBase {
@Feature({"TextInput"})
public void testContentEditableEvents_CommitText() throws Throwable {
focusElementAndWaitForStateUpdate("contenteditable_event");
+ clearEventLogs();
Changwan Ryu 2016/05/27 01:46:15 here too
+
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");
+ commitText("a", 1);
+ waitAndVerifyUpdateSelection(0, 1, 1, -1, -1);
+ clearEventLogs();
+
+ deleteSurroundingText(1, 0);
+ waitForEventLogs("keydown(229),input,keyup(229)");
Changwan Ryu 2016/05/27 01:46:15 no way this isn't creating selectionchange at all.
yabinh 2016/05/27 04:44:19 You are right. It can create selectionchange event
+ }
+
+ @MediumTest
+ @Feature({"TextInput"})
+ public void testInputTextEvents_DeleteSurroundingText() throws Throwable {
+ commitText("a", 1);
+ waitAndVerifyUpdateSelection(0, 1, 1, -1, -1);
+ clearEventLogs();
+
+ deleteSurroundingText(1, 0);
+ waitForEventLogs("keydown(229),input,keyup(229)");
+ }
+
+ private void clearEventLogs() throws Exception {
+ final String code = "clearEventLogs()";
+ JavaScriptUtils.executeJavaScriptAndWaitForResult(
+ getContentViewCore().getWebContents(), code);
}
private void waitForEventLogs(String expectedLogs) throws Throwable {
« no previous file with comments | « no previous file | content/test/data/android/input/input_forms.html » ('j') | content/test/data/android/input/input_forms.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698