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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(
); | |
934 assertTrue(CriteriaHelper.pollForUIThreadCriteria(new Criteria() { | 933 assertTrue(CriteriaHelper.pollForUIThreadCriteria(new Criteria() { |
935 @Override | 934 @Override |
936 public boolean isSatisfied() { | 935 public boolean isSatisfied() { |
937 return pastePopup.isShowing(); | 936 return mContentViewCore.isPastePopupShowing(); |
938 } | 937 } |
939 })); | 938 })); |
940 | 939 |
941 DOMUtils.clickNode(this, mContentViewCore, "input_text"); | 940 DOMUtils.clickNode(this, mContentViewCore, "input_text"); |
942 assertWaitForKeyboardStatus(true); | 941 assertWaitForKeyboardStatus(true); |
943 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); | 942 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); |
944 setComposingText("h", 1); | 943 setComposingText("h", 1); |
945 assertTrue(CriteriaHelper.pollForUIThreadCriteria(new Criteria() { | 944 assertTrue(CriteriaHelper.pollForUIThreadCriteria(new Criteria() { |
946 @Override | 945 @Override |
947 public boolean isSatisfied() { | 946 public boolean isSatisfied() { |
948 return !pastePopup.isShowing(); | 947 return !mContentViewCore.isPastePopupShowing(); |
949 } | 948 } |
950 })); | 949 })); |
951 assertFalse(mContentViewCore.hasInsertion()); | 950 assertFalse(mContentViewCore.hasInsertion()); |
952 } | 951 } |
953 | 952 |
954 @SmallTest | 953 @SmallTest |
955 @Feature({"TextInput"}) | 954 @Feature({"TextInput"}) |
956 public void testSelectionClearedOnKeyEvent() throws Throwable { | 955 public void testSelectionClearedOnKeyEvent() throws Throwable { |
957 commitText("hello", 1); | 956 commitText("hello", 1); |
958 waitAndVerifyStatesAndCalls(1, "hello", 5, 5, -1, -1); | 957 waitAndVerifyStatesAndCalls(1, "hello", 5, 5, -1, -1); |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 public void assertEqualState(String text, int selectionStart, int select
ionEnd, | 1270 public void assertEqualState(String text, int selectionStart, int select
ionEnd, |
1272 int compositionStart, int compositionEnd) { | 1271 int compositionStart, int compositionEnd) { |
1273 assertEquals("Text did not match", text, mText); | 1272 assertEquals("Text did not match", text, mText); |
1274 assertEquals("Selection start did not match", selectionStart, mSelec
tionStart); | 1273 assertEquals("Selection start did not match", selectionStart, mSelec
tionStart); |
1275 assertEquals("Selection end did not match", selectionEnd, mSelection
End); | 1274 assertEquals("Selection end did not match", selectionEnd, mSelection
End); |
1276 assertEquals("Composition start did not match", compositionStart, mC
ompositionStart); | 1275 assertEquals("Composition start did not match", compositionStart, mC
ompositionStart); |
1277 assertEquals("Composition end did not match", compositionEnd, mCompo
sitionEnd); | 1276 assertEquals("Composition end did not match", compositionEnd, mCompo
sitionEnd); |
1278 } | 1277 } |
1279 } | 1278 } |
1280 } | 1279 } |
OLD | NEW |