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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); | 156 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); |
157 selectAll(mImeAdapter); | 157 selectAll(mImeAdapter); |
158 copy(mImeAdapter); | 158 copy(mImeAdapter); |
159 assertWaitForKeyboardStatus(true); | 159 assertWaitForKeyboardStatus(true); |
160 assertEquals(11, Selection.getSelectionEnd(mContentViewCore.getEditableF
orTest())); | 160 assertEquals(11, Selection.getSelectionEnd(mContentViewCore.getEditableF
orTest())); |
161 assertEquals(11, Selection.getSelectionEnd(mContentViewCore.getEditableF
orTest())); | 161 assertEquals(11, Selection.getSelectionEnd(mContentViewCore.getEditableF
orTest())); |
162 } | 162 } |
163 | 163 |
164 @SmallTest | 164 @SmallTest |
165 @Feature({"TextInput"}) | 165 @Feature({"TextInput"}) |
| 166 public void testImeNotShownOnLongPressingEmptyInput() throws Exception { |
| 167 DOMUtils.focusNode(mContentViewCore, "input_radio"); |
| 168 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); |
| 169 assertWaitForKeyboardStatus(false); |
| 170 commitText(mConnection, "Sample Text", 1); |
| 171 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); |
| 172 assertWaitForKeyboardStatus(true); |
| 173 } |
| 174 |
| 175 @SmallTest |
| 176 @Feature({"TextInput"}) |
166 public void testImeCut() throws Exception { | 177 public void testImeCut() throws Exception { |
167 commitText(mConnection, "snarful", 1); | 178 commitText(mConnection, "snarful", 1); |
168 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "snarful",
7, 7, -1, -1); | 179 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "snarful",
7, 7, -1, -1); |
169 | 180 |
170 setSelection(mConnection, 1, 5); | 181 setSelection(mConnection, 1, 5); |
171 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "snarful",
1, 5, -1, -1); | 182 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "snarful",
1, 5, -1, -1); |
172 | 183 |
173 cut(mImeAdapter); | 184 cut(mImeAdapter); |
174 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 3, "sul", 1,
1, -1, -1); | 185 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 3, "sul", 1,
1, -1, -1); |
175 | 186 |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 public void assertEqualState(String text, int selectionStart, int select
ionEnd, | 770 public void assertEqualState(String text, int selectionStart, int select
ionEnd, |
760 int compositionStart, int compositionEnd) { | 771 int compositionStart, int compositionEnd) { |
761 assertEquals("Text did not match", text, mText); | 772 assertEquals("Text did not match", text, mText); |
762 assertEquals("Selection start did not match", selectionStart, mSelec
tionStart); | 773 assertEquals("Selection start did not match", selectionStart, mSelec
tionStart); |
763 assertEquals("Selection end did not match", selectionEnd, mSelection
End); | 774 assertEquals("Selection end did not match", selectionEnd, mSelection
End); |
764 assertEquals("Composition start did not match", compositionStart, mC
ompositionStart); | 775 assertEquals("Composition start did not match", compositionStart, mC
ompositionStart); |
765 assertEquals("Composition end did not match", compositionEnd, mCompo
sitionEnd); | 776 assertEquals("Composition end did not match", compositionEnd, mCompo
sitionEnd); |
766 } | 777 } |
767 } | 778 } |
768 } | 779 } |
OLD | NEW |