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

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

Issue 1283193002: Clear the selection and insertion flags only upon getting the selection event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/ContentViewCore.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 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 finishComposingText(); 912 finishComposingText();
913 913
914 // H 914 // H
915 expectUpdateStateCall(); 915 expectUpdateStateCall();
916 setComposingText("h", 1); 916 setComposingText("h", 1);
917 assertEquals(COMPOSITION_KEY_CODE, mImeAdapter.mLastSyntheticKeyCode); 917 assertEquals(COMPOSITION_KEY_CODE, mImeAdapter.mLastSyntheticKeyCode);
918 } 918 }
919 919
920 @SmallTest 920 @SmallTest
921 @Feature({"TextInput"}) 921 @Feature({"TextInput"})
922 public void testPastePopupShowOnLongPress() throws Throwable { 922 public void testPastePopupShowAndHide() throws Throwable {
923 commitText("hello", 1); 923 commitText("hello", 1);
924 waitAndVerifyStatesAndCalls(1, "hello", 5, 5, -1, -1); 924 waitAndVerifyStatesAndCalls(1, "hello", 5, 5, -1, -1);
925 925
926 selectAll(); 926 selectAll();
927 waitAndVerifyStatesAndCalls(2, "hello", 0, 5, -1, -1); 927 waitAndVerifyStatesAndCalls(2, "hello", 0, 5, -1, -1);
928 928
929 cut(); 929 cut();
930 waitAndVerifyStatesAndCalls(0, "", 0, 0, -1, -1); 930 waitAndVerifyStatesAndCalls(0, "", 0, 0, -1, -1);
931 931
932 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); 932 DOMUtils.longPressNode(this, mContentViewCore, "input_text");
933 final PastePopupMenu pastePopup = mContentViewCore.getPastePopupForTest( ); 933 final PastePopupMenu pastePopup = mContentViewCore.getPastePopupForTest( );
934 assertTrue(CriteriaHelper.pollForUIThreadCriteria(new Criteria() { 934 assertTrue(CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
935 @Override 935 @Override
936 public boolean isSatisfied() { 936 public boolean isSatisfied() {
937 return pastePopup.isShowing(); 937 return pastePopup.isShowing();
938 } 938 }
939 })); 939 }));
940
941 DOMUtils.clickNode(this, mContentViewCore, "input_text");
942 assertWaitForKeyboardStatus(true);
943 DOMUtils.longPressNode(this, mContentViewCore, "input_text");
944 setComposingText("h", 1);
AKV 2015/08/12 13:44:43 It would be good to check the insertion status aft
945 assertTrue(CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
946 @Override
947 public boolean isSatisfied() {
948 return !pastePopup.isShowing();
949 }
950 }));
940 } 951 }
941 952
942 @SmallTest 953 @SmallTest
943 @Feature({"TextInput"}) 954 @Feature({"TextInput"})
944 public void testTextHandlesPreservedWithDpadNavigation() throws Throwable { 955 public void testTextHandlesPreservedWithDpadNavigation() throws Throwable {
945 DOMUtils.longPressNode(this, mContentViewCore, "plain_text"); 956 DOMUtils.longPressNode(this, mContentViewCore, "plain_text");
946 assertWaitForSelectActionBarStatus(true); 957 assertWaitForSelectActionBarStatus(true);
947 assertTrue(mContentViewCore.hasSelection()); 958 assertTrue(mContentViewCore.hasSelection());
948 959
949 dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPA D_DOWN)); 960 dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPA D_DOWN));
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 public void assertEqualState(String text, int selectionStart, int select ionEnd, 1253 public void assertEqualState(String text, int selectionStart, int select ionEnd,
1243 int compositionStart, int compositionEnd) { 1254 int compositionStart, int compositionEnd) {
1244 assertEquals("Text did not match", text, mText); 1255 assertEquals("Text did not match", text, mText);
1245 assertEquals("Selection start did not match", selectionStart, mSelec tionStart); 1256 assertEquals("Selection start did not match", selectionStart, mSelec tionStart);
1246 assertEquals("Selection end did not match", selectionEnd, mSelection End); 1257 assertEquals("Selection end did not match", selectionEnd, mSelection End);
1247 assertEquals("Composition start did not match", compositionStart, mC ompositionStart); 1258 assertEquals("Composition start did not match", compositionStart, mC ompositionStart);
1248 assertEquals("Composition end did not match", compositionEnd, mCompo sitionEnd); 1259 assertEquals("Composition end did not match", compositionEnd, mCompo sitionEnd);
1249 } 1260 }
1250 } 1261 }
1251 } 1262 }
OLDNEW
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698