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.app.Activity; | 7 import android.app.Activity; |
8 import android.content.ClipData; | 8 import android.content.ClipData; |
9 import android.content.ClipboardManager; | 9 import android.content.ClipboardManager; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 | 566 |
567 // Simulate switch of input fields. | 567 // Simulate switch of input fields. |
568 finishComposingText(mConnection); | 568 finishComposingText(mConnection); |
569 | 569 |
570 // H | 570 // H |
571 expectUpdateStateCall(mConnection); | 571 expectUpdateStateCall(mConnection); |
572 setComposingText(mConnection, "h", 1); | 572 setComposingText(mConnection, "h", 1); |
573 assertEquals(KeyEvent.KEYCODE_H, mImeAdapter.mLastSyntheticKeyCode); | 573 assertEquals(KeyEvent.KEYCODE_H, mImeAdapter.mLastSyntheticKeyCode); |
574 } | 574 } |
575 | 575 |
| 576 @SmallTest |
| 577 @Feature({"TextInput"}) |
| 578 public void testPastePopupShowOnLongPress() throws Throwable { |
| 579 commitText(mConnection, "hello", 1); |
| 580 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "hello", 5
, 5, -1, -1); |
| 581 |
| 582 selectAll(mImeAdapter); |
| 583 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "hello", 0
, 5, -1, -1); |
| 584 |
| 585 cut(mImeAdapter); |
| 586 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0,
-1, -1); |
| 587 |
| 588 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); |
| 589 final PastePopupMenu pastePopup = mContentViewCore.getPastePopupForTest(
); |
| 590 assertTrue(CriteriaHelper.pollForCriteria(new Criteria() { |
| 591 @Override |
| 592 public boolean isSatisfied() { |
| 593 return pastePopup.isShowing(); |
| 594 } |
| 595 })); |
| 596 } |
| 597 |
576 private void performGo(final AdapterInputConnection inputConnection, | 598 private void performGo(final AdapterInputConnection inputConnection, |
577 TestCallbackHelperContainer testCallbackHelperContainer) throws Thro
wable { | 599 TestCallbackHelperContainer testCallbackHelperContainer) throws Thro
wable { |
578 handleBlockingCallbackAction( | 600 handleBlockingCallbackAction( |
579 testCallbackHelperContainer.getOnPageFinishedHelper(), | 601 testCallbackHelperContainer.getOnPageFinishedHelper(), |
580 new Runnable() { | 602 new Runnable() { |
581 @Override | 603 @Override |
582 public void run() { | 604 public void run() { |
583 inputConnection.performEditorAction(EditorInfo.IME_ACTIO
N_GO); | 605 inputConnection.performEditorAction(EditorInfo.IME_ACTIO
N_GO); |
584 } | 606 } |
585 }); | 607 }); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 public void assertEqualState(String text, int selectionStart, int select
ionEnd, | 835 public void assertEqualState(String text, int selectionStart, int select
ionEnd, |
814 int compositionStart, int compositionEnd) { | 836 int compositionStart, int compositionEnd) { |
815 assertEquals("Text did not match", text, mText); | 837 assertEquals("Text did not match", text, mText); |
816 assertEquals("Selection start did not match", selectionStart, mSelec
tionStart); | 838 assertEquals("Selection start did not match", selectionStart, mSelec
tionStart); |
817 assertEquals("Selection end did not match", selectionEnd, mSelection
End); | 839 assertEquals("Selection end did not match", selectionEnd, mSelection
End); |
818 assertEquals("Composition start did not match", compositionStart, mC
ompositionStart); | 840 assertEquals("Composition start did not match", compositionStart, mC
ompositionStart); |
819 assertEquals("Composition end did not match", compositionEnd, mCompo
sitionEnd); | 841 assertEquals("Composition end did not match", compositionEnd, mCompo
sitionEnd); |
820 } | 842 } |
821 } | 843 } |
822 } | 844 } |
OLD | NEW |