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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 commitText(mConnection, "Sample Text", 1); | 151 commitText(mConnection, "Sample Text", 1); |
152 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, | 152 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, |
153 "Sample Text", 11, 11, -1, -1); | 153 "Sample Text", 11, 11, -1, -1); |
154 DOMUtils.clickNode(this, mContentViewCore, "input_text"); | 154 DOMUtils.clickNode(this, mContentViewCore, "input_text"); |
155 assertWaitForKeyboardStatus(true); | 155 assertWaitForKeyboardStatus(true); |
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())); | |
162 } | 161 } |
163 | 162 |
164 @SmallTest | 163 @SmallTest |
164 @Feature({"TextInput"}) | |
165 public void testImeNotDismissedAfterCutSelection() throws Exception { | |
166 commitText(mConnection, "Sample Text", 1); | |
167 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, | |
168 "Sample Text", 11, 11, -1, -1); | |
169 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); | |
170 assertWaitForSelectActionBarStatus(true); | |
171 assertWaitForKeyboardStatus(true); | |
172 selectAll(mImeAdapter); | |
jdduke (slow)
2014/08/27 14:53:12
Is this |selectAll()| call necessary? Isn't long p
ankit
2014/08/28 06:30:16
Done.
Long pressing is sufficient to select the te
| |
173 cut(mImeAdapter); | |
174 assertWaitForKeyboardStatus(true); | |
175 assertWaitForSelectActionBarStatus(false); | |
176 } | |
177 | |
178 @SmallTest | |
165 @Feature({"TextInput"}) | 179 @Feature({"TextInput"}) |
166 public void testImeNotShownOnLongPressingEmptyInput() throws Exception { | 180 public void testImeNotShownOnLongPressingEmptyInput() throws Exception { |
167 DOMUtils.focusNode(mContentViewCore, "input_radio"); | 181 DOMUtils.focusNode(mContentViewCore, "input_radio"); |
168 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); | 182 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); |
169 assertWaitForKeyboardStatus(false); | 183 assertWaitForKeyboardStatus(false); |
170 commitText(mConnection, "Sample Text", 1); | 184 commitText(mConnection, "Sample Text", 1); |
171 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); | 185 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); |
172 assertWaitForKeyboardStatus(true); | 186 assertWaitForKeyboardStatus(true); |
173 } | 187 } |
174 | 188 |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
790 public void assertEqualState(String text, int selectionStart, int select ionEnd, | 804 public void assertEqualState(String text, int selectionStart, int select ionEnd, |
791 int compositionStart, int compositionEnd) { | 805 int compositionStart, int compositionEnd) { |
792 assertEquals("Text did not match", text, mText); | 806 assertEquals("Text did not match", text, mText); |
793 assertEquals("Selection start did not match", selectionStart, mSelec tionStart); | 807 assertEquals("Selection start did not match", selectionStart, mSelec tionStart); |
794 assertEquals("Selection end did not match", selectionEnd, mSelection End); | 808 assertEquals("Selection end did not match", selectionEnd, mSelection End); |
795 assertEquals("Composition start did not match", compositionStart, mC ompositionStart); | 809 assertEquals("Composition start did not match", compositionStart, mC ompositionStart); |
796 assertEquals("Composition end did not match", compositionEnd, mCompo sitionEnd); | 810 assertEquals("Composition end did not match", compositionEnd, mCompo sitionEnd); |
797 } | 811 } |
798 } | 812 } |
799 } | 813 } |
OLD | NEW |