Chromium Code Reviews| 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..8811348772403ecd67d7adfc9a3b95940c48365e 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 |
| @@ -418,6 +418,103 @@ public class ImeTest { |
| @Test |
| @SmallTest |
| + @Feature({"TextInput", "Main"}) |
| + public void testAdvanceFocusNextAndPrevious() throws Exception { |
| + // Form1 forward and backward focus |
|
Changwan Ryu
2017/05/10 16:20:58
Do we really need to test both forms? If not, coul
AKVT
2017/05/11 08:47:39
Ok. Kind of redundant. Thanks
|
| + mRule.focusElement("input_text"); |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NEXT) |
|
Changwan Ryu
2017/05/10 16:20:59
Could you add a new function
private int getImeAc
AKVT
2017/05/11 08:47:39
Assert.assertEquals(EditorInfo.IME_ACTION_NEXT, ge
|
| + != 0); |
| + |
| + // Forward direction focus |
| + mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT); |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NONE) |
| + != 0); |
| + mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT); |
| + // Now we have reached the last element of the form, hence focus won't change after issuing |
| + // NEXT. |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NONE) |
| + != 0); |
| + |
| + // Backward direction focus |
| + mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS); |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NONE) |
| + != 0); |
| + mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS); |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NEXT) |
| + != 0); |
| + mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS); |
| + // Now we have reached the first element of the form, hence focus won't change after issuing |
| + // PREVIOUS. |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NEXT) |
| + != 0); |
| + |
| + // Form2 forward and backward focus |
| + mRule.focusElement("textarea"); |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NONE) |
| + != 0); |
| + |
| + // Forward direction focus |
| + mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT); |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NONE) |
| + != 0); |
| + mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT); |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NONE) |
| + != 0); |
| + mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT); |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NEXT) |
| + != 0); |
| + mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT); |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NEXT) |
| + != 0); |
| + mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT); |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NONE) |
| + != 0); |
| + // Now we have reached the last element of the form, hence focus won't change after issuing |
| + // NEXT. |
| + mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT); |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NONE) |
| + != 0); |
| + |
| + // Backward direction focus |
| + mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS); |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NEXT) |
| + != 0); |
| + mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS); |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NEXT) |
| + != 0); |
| + mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS); |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NONE) |
| + != 0); |
| + mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS); |
| + Assert.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NONE) |
| + != 0); |
| + // 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.assertTrue( |
| + (mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo.IME_ACTION_NONE) |
| + != 0); |
| + } |
| + |
| + @Test |
| + @SmallTest |
| @DisabledTest(message = "crbug.com/694812") |
| @Feature({"TextInput"}) |
| public void testShowAndHideSoftInput() throws Exception { |