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; |
11 import android.test.suitebuilder.annotation.MediumTest; | 11 import android.test.suitebuilder.annotation.MediumTest; |
12 import android.test.suitebuilder.annotation.SmallTest; | 12 import android.test.suitebuilder.annotation.SmallTest; |
13 import android.text.Editable; | 13 import android.text.Editable; |
14 import android.text.Selection; | |
14 import android.text.TextUtils; | 15 import android.text.TextUtils; |
15 import android.view.KeyEvent; | 16 import android.view.KeyEvent; |
16 import android.view.View; | 17 import android.view.View; |
17 import android.view.inputmethod.EditorInfo; | 18 import android.view.inputmethod.EditorInfo; |
18 | 19 |
19 import org.chromium.base.ThreadUtils; | 20 import org.chromium.base.ThreadUtils; |
20 import org.chromium.base.test.util.Feature; | 21 import org.chromium.base.test.util.Feature; |
21 import org.chromium.base.test.util.UrlUtils; | 22 import org.chromium.base.test.util.UrlUtils; |
22 import org.chromium.content.browser.ContentViewCore; | 23 import org.chromium.content.browser.ContentViewCore; |
23 import org.chromium.content.browser.test.util.Criteria; | 24 import org.chromium.content.browser.test.util.Criteria; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 assertWaitForKeyboardStatus(false); | 138 assertWaitForKeyboardStatus(false); |
138 | 139 |
139 DOMUtils.clickNode(this, mContentViewCore, "input_text"); | 140 DOMUtils.clickNode(this, mContentViewCore, "input_text"); |
140 assertWaitForKeyboardStatus(true); | 141 assertWaitForKeyboardStatus(true); |
141 assertEquals(5, mInputMethodManagerWrapper.getEditorInfo().initialSelSta rt); | 142 assertEquals(5, mInputMethodManagerWrapper.getEditorInfo().initialSelSta rt); |
142 assertEquals(5, mInputMethodManagerWrapper.getEditorInfo().initialSelEnd ); | 143 assertEquals(5, mInputMethodManagerWrapper.getEditorInfo().initialSelEnd ); |
143 } | 144 } |
144 | 145 |
145 @SmallTest | 146 @SmallTest |
146 @Feature({"TextInput"}) | 147 @Feature({"TextInput"}) |
148 public void testKeyboardNotDismissedAfterCopySelection() throws Exception { | |
149 commitText(mConnection, "Sample Text", 1); | |
150 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, | |
151 "Sample Text", 11, 11, -1, -1); | |
Ted C
2014/06/20 16:33:57
+2 indent
Ted C
2014/06/20 19:04:33
Actually, +4 indent
AKVT
2014/06/21 07:20:13
Done.
| |
152 DOMUtils.clickNode(this, mContentViewCore, "input_text"); | |
153 assertWaitForKeyboardStatus(true); | |
154 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); | |
155 selectAll(mImeAdapter); | |
156 copy(mImeAdapter); | |
157 assertWaitForKeyboardStatus(true); | |
158 assertEquals(11, Selection.getSelectionEnd(mContentViewCore.getEditableF orTest())); | |
159 assertEquals(11, Selection.getSelectionEnd(mContentViewCore.getEditableF orTest())); | |
160 } | |
161 | |
162 @SmallTest | |
163 @Feature({"TextInput"}) | |
147 public void testImeCut() throws Exception { | 164 public void testImeCut() throws Exception { |
148 commitText(mConnection, "snarful", 1); | 165 commitText(mConnection, "snarful", 1); |
149 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "snarful", 7, 7, -1, -1); | 166 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "snarful", 7, 7, -1, -1); |
150 | 167 |
151 setSelection(mConnection, 1, 5); | 168 setSelection(mConnection, 1, 5); |
152 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "snarful", 1, 5, -1, -1); | 169 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "snarful", 1, 5, -1, -1); |
153 | 170 |
154 cut(mImeAdapter); | 171 cut(mImeAdapter); |
155 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 3, "sul", 1, 1, -1, -1); | 172 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 3, "sul", 1, 1, -1, -1); |
156 | 173 |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
495 public void assertEqualState(String text, int selectionStart, int select ionEnd, | 512 public void assertEqualState(String text, int selectionStart, int select ionEnd, |
496 int compositionStart, int compositionEnd) { | 513 int compositionStart, int compositionEnd) { |
497 assertEquals("Text did not match", text, mText); | 514 assertEquals("Text did not match", text, mText); |
498 assertEquals("Selection start did not match", selectionStart, mSelec tionStart); | 515 assertEquals("Selection start did not match", selectionStart, mSelec tionStart); |
499 assertEquals("Selection end did not match", selectionEnd, mSelection End); | 516 assertEquals("Selection end did not match", selectionEnd, mSelection End); |
500 assertEquals("Composition start did not match", compositionStart, mC ompositionStart); | 517 assertEquals("Composition start did not match", compositionStart, mC ompositionStart); |
501 assertEquals("Composition end did not match", compositionEnd, mCompo sitionEnd); | 518 assertEquals("Composition end did not match", compositionEnd, mCompo sitionEnd); |
502 } | 519 } |
503 } | 520 } |
504 } | 521 } |
OLD | NEW |