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

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

Issue 2839993002: [Android] Adding Smart GO/NEXT feature in Chrome (Closed)
Patch Set: Fixed ImeTest review comments. Created 3 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 edf7101d03a303cd8b575a15d08d6ac4c4517249..7907c31f2b1b4b1269a973b878046e0dbe24eecb 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
@@ -416,6 +416,49 @@ public class ImeTest {
Assert.assertEquals(5, mRule.getConnectionFactory().getOutAttrs().initialSelEnd);
}
+ private int getImeActions() {
+ return mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_MASK_ACTION;
+ }
+
+ @Test
+ @SmallTest
+ @Feature({"TextInput", "Main"})
+ public void testAdvanceFocusNextAndPrevious() throws Exception {
+ // Forward and backward focus in form2
+ mRule.focusElement("textarea");
+ Assert.assertEquals(EditorInfo.IME_ACTION_NONE, getImeActions());
+
+ // Forward direction focus
+ mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT);
+ Assert.assertEquals(EditorInfo.IME_ACTION_NONE, getImeActions());
+ mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT);
+ Assert.assertEquals(EditorInfo.IME_ACTION_NONE, getImeActions());
+ mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT);
+ Assert.assertTrue((EditorInfo.IME_ACTION_NEXT & getImeActions()) != 0);
Changwan Ryu 2017/05/11 09:10:52 This is somewhat concerning. What values do you ge
AKVT 2017/05/11 09:48:49 I am getting IME_ACTION_NONE java.lang.AssertionE
Changwan Ryu 2017/05/11 12:04:37 IME_ACTION_NEXT = 5, IME_ACTION_NONE = 1 You shou
AKVT 2017/05/11 12:16:44 But, I was expecting IME_ACTION_NEXT, because it's
+ mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT);
+ Assert.assertTrue((EditorInfo.IME_ACTION_NEXT & getImeActions()) != 0);
+ mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT);
+ Assert.assertEquals(EditorInfo.IME_ACTION_NONE, getImeActions());
+ // Now we have reached the last element of the form, hence focus won't change after issuing
+ // NEXT.
Changwan Ryu 2017/05/11 09:10:52 So, the last element is content editable, right? C
AKVT 2017/05/11 09:48:48 Even my check to Assert.assertEquals(EditorInfo.T
+ mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT);
+ Assert.assertEquals(EditorInfo.IME_ACTION_NONE, getImeActions());
+
+ // Backward direction focus
+ mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS);
+ Assert.assertTrue((EditorInfo.IME_ACTION_NEXT & getImeActions()) != 0);
+ mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS);
+ Assert.assertTrue((EditorInfo.IME_ACTION_NEXT & getImeActions()) != 0);
+ mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS);
+ Assert.assertEquals(EditorInfo.IME_ACTION_NONE, getImeActions());
+ mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS);
+ Assert.assertEquals(EditorInfo.IME_ACTION_NONE, getImeActions());
+ // Now we have reached the first element of the form, hence focus won't change after issuing
+ // PREVIOUS.
+ mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS);
+ Assert.assertEquals(EditorInfo.IME_ACTION_NONE, getImeActions());
+ }
+
@Test
@SmallTest
@DisabledTest(message = "crbug.com/694812")

Powered by Google App Engine
This is Rietveld 408576698