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

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: Reverted unnecessary touch in ImeTest. 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..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 {

Powered by Google App Engine
This is Rietveld 408576698