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

Side by Side 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: Added few test related to Smart Go/next logic 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content.browser.input; 5 package org.chromium.content.browser.input;
6 6
7 import android.content.ClipData; 7 import android.content.ClipData;
8 import android.content.ClipboardManager; 8 import android.content.ClipboardManager;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.res.Configuration; 10 import android.content.res.Configuration;
(...skipping 21 matching lines...) Expand all
32 import org.chromium.content.browser.test.util.JavaScriptUtils; 32 import org.chromium.content.browser.test.util.JavaScriptUtils;
33 import org.chromium.ui.base.ime.TextInputType; 33 import org.chromium.ui.base.ime.TextInputType;
34 34
35 import java.util.concurrent.Callable; 35 import java.util.concurrent.Callable;
36 36
37 /** 37 /**
38 * IME (input method editor) and text input tests. 38 * IME (input method editor) and text input tests.
39 */ 39 */
40 @RunWith(ContentJUnit4ClassRunner.class) 40 @RunWith(ContentJUnit4ClassRunner.class)
41 public class ImeTest { 41 public class ImeTest {
42 private static final int DEFAULT_IME_OPTIONS =
43 EditorInfo.IME_FLAG_NO_FULLSCREEN | EditorInfo.IME_FLAG_NO_EXTRACT_U I;
Changwan Ryu 2017/05/09 18:12:16 Instead of make another dependency on the producti
AKVT 2017/05/10 09:31:38 Done. That seems to be more easier.
44
42 @Rule 45 @Rule
43 public ImeActivityTestRule mRule = new ImeActivityTestRule(); 46 public ImeActivityTestRule mRule = new ImeActivityTestRule();
44 47
45 @Before 48 @Before
46 public void setUp() throws Exception { 49 public void setUp() throws Exception {
47 mRule.setUp(); 50 mRule.setUp();
48 } 51 }
49 52
50 @Test 53 @Test
51 @MediumTest 54 @MediumTest
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 mRule.restartInput(); 414 mRule.restartInput();
412 DOMUtils.clickNode(mRule.getContentViewCore(), "input_text"); 415 DOMUtils.clickNode(mRule.getContentViewCore(), "input_text");
413 mRule.assertWaitForKeyboardStatus(true); 416 mRule.assertWaitForKeyboardStatus(true);
414 417
415 Assert.assertEquals(5, mRule.getConnectionFactory().getOutAttrs().initia lSelStart); 418 Assert.assertEquals(5, mRule.getConnectionFactory().getOutAttrs().initia lSelStart);
416 Assert.assertEquals(5, mRule.getConnectionFactory().getOutAttrs().initia lSelEnd); 419 Assert.assertEquals(5, mRule.getConnectionFactory().getOutAttrs().initia lSelEnd);
417 } 420 }
418 421
419 @Test 422 @Test
420 @SmallTest 423 @SmallTest
424 @Feature({"TextInput", "Main"})
425 public void testAdvanceFocusNextAndPrevious() throws Exception {
426 DOMUtils.clickNode(mRule.getContentViewCore(), "input_text");
427 mRule.assertWaitForKeyboardStatus(true);
428 Assert.assertEquals(DEFAULT_IME_OPTIONS | EditorInfo.IME_ACTION_NEXT,
AKVT 2017/05/09 17:22:18 I am seeing a failure in this line. As per the log
Changwan Ryu 2017/05/09 18:12:16 My initial guess is that assertWaitForKeyboardStat
AKVT 2017/05/10 09:31:38 Thanks. I corrected it using mRule.focusElement();
429 mRule.getInputMethodManagerWrapper().getImeOptions());
430
431 // Forward direction focus
432 mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT);
433 Assert.assertEquals(DEFAULT_IME_OPTIONS | EditorInfo.IME_ACTION_NONE,
434 mRule.getInputMethodManagerWrapper().getImeOptions());
435 mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT);
436 // Now we have reached the last element of the form, hence focus won't c hange after issuing
437 // NEXT.
438 Assert.assertEquals(DEFAULT_IME_OPTIONS | EditorInfo.IME_ACTION_NONE,
439 mRule.getInputMethodManagerWrapper().getImeOptions());
440 }
441
442 @Test
443 @SmallTest
421 @DisabledTest(message = "crbug.com/694812") 444 @DisabledTest(message = "crbug.com/694812")
422 @Feature({"TextInput"}) 445 @Feature({"TextInput"})
423 public void testShowAndHideSoftInput() throws Exception { 446 public void testShowAndHideSoftInput() throws Exception {
424 mRule.focusElement("input_radio", false); 447 mRule.focusElement("input_radio", false);
425 448
426 // hideSoftKeyboard(), mRule.restartInput() 449 // hideSoftKeyboard(), mRule.restartInput()
427 mRule.waitForKeyboardStates(0, 1, 1, new Integer[] {}); 450 mRule.waitForKeyboardStates(0, 1, 1, new Integer[] {});
428 451
429 // When input connection is null, we still need to set flags to prevent InputMethodService 452 // When input connection is null, we still need to set flags to prevent InputMethodService
430 // from entering fullscreen mode and from opening custom UI. 453 // from entering fullscreen mode and from opening custom UI.
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 }); 1512 });
1490 Assert.assertEquals("abc", mRule.runBlockingOnImeThread(new Callable<Cha rSequence>() { 1513 Assert.assertEquals("abc", mRule.runBlockingOnImeThread(new Callable<Cha rSequence>() {
1491 @Override 1514 @Override
1492 public CharSequence call() throws Exception { 1515 public CharSequence call() throws Exception {
1493 return connection.getTextBeforeCursor(5, 0); 1516 return connection.getTextBeforeCursor(5, 0);
1494 } 1517 }
1495 })); 1518 }));
1496 } 1519 }
1497 1520
1498 } 1521 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698