OLD | NEW |
---|---|
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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 mRule.commitText("hello", 1); | 409 mRule.commitText("hello", 1); |
410 mRule.waitAndVerifyUpdateSelection(0, 5, 5, -1, -1); | 410 mRule.waitAndVerifyUpdateSelection(0, 5, 5, -1, -1); |
411 mRule.restartInput(); | 411 mRule.restartInput(); |
412 DOMUtils.clickNode(mRule.getContentViewCore(), "input_text"); | 412 DOMUtils.clickNode(mRule.getContentViewCore(), "input_text"); |
413 mRule.assertWaitForKeyboardStatus(true); | 413 mRule.assertWaitForKeyboardStatus(true); |
414 | 414 |
415 Assert.assertEquals(5, mRule.getConnectionFactory().getOutAttrs().initia lSelStart); | 415 Assert.assertEquals(5, mRule.getConnectionFactory().getOutAttrs().initia lSelStart); |
416 Assert.assertEquals(5, mRule.getConnectionFactory().getOutAttrs().initia lSelEnd); | 416 Assert.assertEquals(5, mRule.getConnectionFactory().getOutAttrs().initia lSelEnd); |
417 } | 417 } |
418 | 418 |
419 private int getImeActions() { | |
420 return mRule.getInputMethodManagerWrapper().getImeOptions() & EditorInfo .IME_MASK_ACTION; | |
421 } | |
422 | |
423 @Test | |
424 @SmallTest | |
425 @Feature({"TextInput", "Main"}) | |
426 public void testAdvanceFocusNextAndPrevious() throws Exception { | |
427 // Forward and backward focus in form2 | |
428 mRule.focusElement("textarea"); | |
429 Assert.assertEquals(EditorInfo.IME_ACTION_NONE, getImeActions()); | |
430 | |
431 // Forward direction focus | |
432 mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT); | |
433 Assert.assertEquals(EditorInfo.IME_ACTION_NONE, getImeActions()); | |
434 mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT); | |
435 Assert.assertEquals(EditorInfo.IME_ACTION_NONE, getImeActions()); | |
436 mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT); | |
437 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
| |
438 mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT); | |
439 Assert.assertTrue((EditorInfo.IME_ACTION_NEXT & getImeActions()) != 0); | |
440 mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT); | |
441 Assert.assertEquals(EditorInfo.IME_ACTION_NONE, getImeActions()); | |
442 // Now we have reached the last element of the form, hence focus won't c hange after issuing | |
443 // 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
| |
444 mRule.performEditorAction(EditorInfo.IME_ACTION_NEXT); | |
445 Assert.assertEquals(EditorInfo.IME_ACTION_NONE, getImeActions()); | |
446 | |
447 // Backward direction focus | |
448 mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS); | |
449 Assert.assertTrue((EditorInfo.IME_ACTION_NEXT & getImeActions()) != 0); | |
450 mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS); | |
451 Assert.assertTrue((EditorInfo.IME_ACTION_NEXT & getImeActions()) != 0); | |
452 mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS); | |
453 Assert.assertEquals(EditorInfo.IME_ACTION_NONE, getImeActions()); | |
454 mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS); | |
455 Assert.assertEquals(EditorInfo.IME_ACTION_NONE, getImeActions()); | |
456 // Now we have reached the first element of the form, hence focus won't change after issuing | |
457 // PREVIOUS. | |
458 mRule.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS); | |
459 Assert.assertEquals(EditorInfo.IME_ACTION_NONE, getImeActions()); | |
460 } | |
461 | |
419 @Test | 462 @Test |
420 @SmallTest | 463 @SmallTest |
421 @DisabledTest(message = "crbug.com/694812") | 464 @DisabledTest(message = "crbug.com/694812") |
422 @Feature({"TextInput"}) | 465 @Feature({"TextInput"}) |
423 public void testShowAndHideSoftInput() throws Exception { | 466 public void testShowAndHideSoftInput() throws Exception { |
424 mRule.focusElement("input_radio", false); | 467 mRule.focusElement("input_radio", false); |
425 | 468 |
426 // hideSoftKeyboard(), mRule.restartInput() | 469 // hideSoftKeyboard(), mRule.restartInput() |
427 mRule.waitForKeyboardStates(0, 1, 1, new Integer[] {}); | 470 mRule.waitForKeyboardStates(0, 1, 1, new Integer[] {}); |
428 | 471 |
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1489 }); | 1532 }); |
1490 Assert.assertEquals("abc", mRule.runBlockingOnImeThread(new Callable<Cha rSequence>() { | 1533 Assert.assertEquals("abc", mRule.runBlockingOnImeThread(new Callable<Cha rSequence>() { |
1491 @Override | 1534 @Override |
1492 public CharSequence call() throws Exception { | 1535 public CharSequence call() throws Exception { |
1493 return connection.getTextBeforeCursor(5, 0); | 1536 return connection.getTextBeforeCursor(5, 0); |
1494 } | 1537 } |
1495 })); | 1538 })); |
1496 } | 1539 } |
1497 | 1540 |
1498 } | 1541 } |
OLD | NEW |