Chromium Code Reviews| 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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 543 | 543 |
| 544 // Simulate switch of input fields. | 544 // Simulate switch of input fields. |
| 545 finishComposingText(mConnection); | 545 finishComposingText(mConnection); |
| 546 | 546 |
| 547 // H | 547 // H |
| 548 expectUpdateStateCall(mConnection); | 548 expectUpdateStateCall(mConnection); |
| 549 setComposingText(mConnection, "h", 1); | 549 setComposingText(mConnection, "h", 1); |
| 550 assertEquals(KeyEvent.KEYCODE_H, mImeAdapter.mLastSyntheticKeyCode); | 550 assertEquals(KeyEvent.KEYCODE_H, mImeAdapter.mLastSyntheticKeyCode); |
| 551 } | 551 } |
| 552 | 552 |
| 553 @SmallTest | |
| 554 @Feature({"TextInput"}) | |
| 555 public void testPastePopupShowOnLongPress() throws Throwable { | |
| 556 commitText(mConnection, "hello", 1); | |
| 557 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "hello", 5 , 5, -1, -1); | |
| 558 | |
| 559 selectAll(mImeAdapter); | |
| 560 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "hello", 0 , 5, -1, -1); | |
| 561 | |
| 562 cut(mImeAdapter); | |
| 563 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1); | |
| 564 | |
| 565 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); | |
| 566 | |
|
jdduke (slow)
2014/08/27 17:05:31
Nit: Adding line breaks here doesn't really help,
raghu
2014/08/27 18:45:11
will do the change
raghu
2014/08/28 02:26:16
Done.
| |
| 567 final PastePopupMenu pastePopup = mContentViewCore.getPastePopupForTest( ); | |
| 568 | |
| 569 assertTrue(CriteriaHelper.pollForCriteria(new Criteria() { | |
| 570 @Override | |
| 571 public boolean isSatisfied() { | |
| 572 return pastePopup.isShowing(); | |
| 573 } | |
| 574 })); | |
| 575 } | |
| 576 | |
| 553 private void performGo(final AdapterInputConnection inputConnection, | 577 private void performGo(final AdapterInputConnection inputConnection, |
| 554 TestCallbackHelperContainer testCallbackHelperContainer) throws Thro wable { | 578 TestCallbackHelperContainer testCallbackHelperContainer) throws Thro wable { |
| 555 handleBlockingCallbackAction( | 579 handleBlockingCallbackAction( |
| 556 testCallbackHelperContainer.getOnPageFinishedHelper(), | 580 testCallbackHelperContainer.getOnPageFinishedHelper(), |
| 557 new Runnable() { | 581 new Runnable() { |
| 558 @Override | 582 @Override |
| 559 public void run() { | 583 public void run() { |
| 560 inputConnection.performEditorAction(EditorInfo.IME_ACTIO N_GO); | 584 inputConnection.performEditorAction(EditorInfo.IME_ACTIO N_GO); |
| 561 } | 585 } |
| 562 }); | 586 }); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 790 public void assertEqualState(String text, int selectionStart, int select ionEnd, | 814 public void assertEqualState(String text, int selectionStart, int select ionEnd, |
| 791 int compositionStart, int compositionEnd) { | 815 int compositionStart, int compositionEnd) { |
| 792 assertEquals("Text did not match", text, mText); | 816 assertEquals("Text did not match", text, mText); |
| 793 assertEquals("Selection start did not match", selectionStart, mSelec tionStart); | 817 assertEquals("Selection start did not match", selectionStart, mSelec tionStart); |
| 794 assertEquals("Selection end did not match", selectionEnd, mSelection End); | 818 assertEquals("Selection end did not match", selectionEnd, mSelection End); |
| 795 assertEquals("Composition start did not match", compositionStart, mC ompositionStart); | 819 assertEquals("Composition start did not match", compositionStart, mC ompositionStart); |
| 796 assertEquals("Composition end did not match", compositionEnd, mCompo sitionEnd); | 820 assertEquals("Composition end did not match", compositionEnd, mCompo sitionEnd); |
| 797 } | 821 } |
| 798 } | 822 } |
| 799 } | 823 } |
| OLD | NEW |