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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 475 } |
476 }); | 476 }); |
477 | 477 |
478 // TODO(aurimas): remove this workaround when crbug.com/278584 is fixed. | 478 // TODO(aurimas): remove this workaround when crbug.com/278584 is fixed. |
479 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "hello", 5
, 5, -1, -1); | 479 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "hello", 5
, 5, -1, -1); |
480 // The second new line is not a user visible/editable one, it is a side-
effect of Blink | 480 // The second new line is not a user visible/editable one, it is a side-
effect of Blink |
481 // using <br> internally. | 481 // using <br> internally. |
482 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 3, "hello\n\n
", 6, 6, -1, -1); | 482 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 3, "hello\n\n
", 6, 6, -1, -1); |
483 } | 483 } |
484 | 484 |
| 485 @SmallTest |
| 486 @Feature({"TextInput", "Main"}) |
| 487 public void testTransitionsWhileComposingText() throws Throwable { |
| 488 DOMUtils.focusNode(mContentViewCore, "textarea"); |
| 489 assertWaitForKeyboardStatus(true); |
| 490 |
| 491 mConnection = (TestAdapterInputConnection) getAdapterInputConnection(); |
| 492 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0,
-1, -1); |
| 493 |
| 494 // H |
| 495 expectUpdateStateCall(mConnection); |
| 496 setComposingText(mConnection, "h", 1); |
| 497 assertEquals(KeyEvent.KEYCODE_H, mImeAdapter.mLastSyntheticKeyCode); |
| 498 |
| 499 // Simulate switch of input fields. |
| 500 finishComposingText(mConnection); |
| 501 |
| 502 // H |
| 503 expectUpdateStateCall(mConnection); |
| 504 setComposingText(mConnection, "h", 1); |
| 505 assertEquals(KeyEvent.KEYCODE_H, mImeAdapter.mLastSyntheticKeyCode); |
| 506 } |
| 507 |
485 private void performGo(final AdapterInputConnection inputConnection, | 508 private void performGo(final AdapterInputConnection inputConnection, |
486 TestCallbackHelperContainer testCallbackHelperContainer) throws Thro
wable { | 509 TestCallbackHelperContainer testCallbackHelperContainer) throws Thro
wable { |
487 handleBlockingCallbackAction( | 510 handleBlockingCallbackAction( |
488 testCallbackHelperContainer.getOnPageFinishedHelper(), | 511 testCallbackHelperContainer.getOnPageFinishedHelper(), |
489 new Runnable() { | 512 new Runnable() { |
490 @Override | 513 @Override |
491 public void run() { | 514 public void run() { |
492 inputConnection.performEditorAction(EditorInfo.IME_ACTIO
N_GO); | 515 inputConnection.performEditorAction(EditorInfo.IME_ACTIO
N_GO); |
493 } | 516 } |
494 }); | 517 }); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 public void assertEqualState(String text, int selectionStart, int select
ionEnd, | 735 public void assertEqualState(String text, int selectionStart, int select
ionEnd, |
713 int compositionStart, int compositionEnd) { | 736 int compositionStart, int compositionEnd) { |
714 assertEquals("Text did not match", text, mText); | 737 assertEquals("Text did not match", text, mText); |
715 assertEquals("Selection start did not match", selectionStart, mSelec
tionStart); | 738 assertEquals("Selection start did not match", selectionStart, mSelec
tionStart); |
716 assertEquals("Selection end did not match", selectionEnd, mSelection
End); | 739 assertEquals("Selection end did not match", selectionEnd, mSelection
End); |
717 assertEquals("Composition start did not match", compositionStart, mC
ompositionStart); | 740 assertEquals("Composition start did not match", compositionStart, mC
ompositionStart); |
718 assertEquals("Composition end did not match", compositionEnd, mCompo
sitionEnd); | 741 assertEquals("Composition end did not match", compositionEnd, mCompo
sitionEnd); |
719 } | 742 } |
720 } | 743 } |
721 } | 744 } |
OLD | NEW |