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

Side by Side Diff: content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java

Issue 411383002: Fix composition key-code after switching to a new input field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added reset of state in a couple other places Created 6 years, 4 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
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.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
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
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 }
OLDNEW
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698