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") |