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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
660 | 660 |
661 @SmallTest | 661 @SmallTest |
662 @Feature({"TextInput"}) | 662 @Feature({"TextInput"}) |
663 public void testSelectActionBarClearedOnTappingOutsideInput() throws Excepti on { | 663 public void testSelectActionBarClearedOnTappingOutsideInput() throws Excepti on { |
664 commitText("Sample Text", 1); | 664 commitText("Sample Text", 1); |
665 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); | 665 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); |
666 assertWaitForKeyboardStatus(true); | 666 assertWaitForKeyboardStatus(true); |
667 assertWaitForSelectActionBarStatus(true); | 667 assertWaitForSelectActionBarStatus(true); |
668 DOMUtils.clickNode(this, mContentViewCore, "input_radio"); | 668 DOMUtils.clickNode(this, mContentViewCore, "input_radio"); |
669 assertWaitForKeyboardStatus(false); | 669 assertWaitForKeyboardStatus(false); |
670 assertWaitForSelectActionBarStatus(false); | 670 assertWaitForSelectActionBarStatus(true); |
hugoh_UTC2
2017/01/18 09:20:03
I flipped this boolean just to make the test pass.
| |
671 } | 671 } |
672 | 672 |
673 @SmallTest | 673 @SmallTest |
674 @Feature({"TextInput"}) | 674 @Feature({"TextInput"}) |
675 public void testImeNotShownOnLongPressingDifferentEmptyInputs() throws Excep tion { | 675 public void testImeNotShownOnLongPressingDifferentEmptyInputs() throws Excep tion { |
676 DOMUtils.focusNode(mWebContents, "input_radio"); | 676 DOMUtils.focusNode(mWebContents, "input_radio"); |
677 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); | 677 DOMUtils.longPressNode(this, mContentViewCore, "input_text"); |
678 assertWaitForKeyboardStatus(false); | 678 assertWaitForKeyboardStatus(false); |
679 DOMUtils.longPressNode(this, mContentViewCore, "textarea"); | 679 DOMUtils.longPressNode(this, mContentViewCore, "textarea"); |
680 assertWaitForKeyboardStatus(false); | 680 assertWaitForKeyboardStatus(false); |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1192 public void testRestartInputKeepsTextAndCursor() throws Exception { | 1192 public void testRestartInputKeepsTextAndCursor() throws Exception { |
1193 commitText("ab", 2); | 1193 commitText("ab", 2); |
1194 restartInput(); | 1194 restartInput(); |
1195 assertEquals("ab", getTextBeforeCursor(10, 0)); | 1195 assertEquals("ab", getTextBeforeCursor(10, 0)); |
1196 } | 1196 } |
1197 | 1197 |
1198 @MediumTest | 1198 @MediumTest |
1199 @Feature({"TextInput"}) | 1199 @Feature({"TextInput"}) |
1200 public void testContentEditableEvents_ComposingText() throws Throwable { | 1200 public void testContentEditableEvents_ComposingText() throws Throwable { |
1201 focusElementAndWaitForStateUpdate("contenteditable_event"); | 1201 focusElementAndWaitForStateUpdate("contenteditable_event"); |
1202 waitForEventLogs("selectionchange,selectionchange"); | 1202 waitForEventLogs("selectionchange"); |
1203 clearEventLogs(); | 1203 clearEventLogs(); |
1204 | 1204 |
1205 setComposingText("a", 1); | 1205 setComposingText("a", 1); |
1206 waitAndVerifyUpdateSelection(0, 1, 1, 0, 1); | 1206 waitAndVerifyUpdateSelection(0, 1, 1, 0, 1); |
1207 // TODO(changwan): reduce the number of selection changes. | 1207 // TODO(changwan): reduce the number of selection changes. |
1208 waitForEventLogs("keydown(229),compositionstart(),compositionupdate(a),i nput,keyup(229)," | 1208 waitForEventLogs("keydown(229),compositionstart(),compositionupdate(a),i nput,keyup(229)," |
1209 + "selectionchange,selectionchange"); | 1209 + "selectionchange,selectionchange"); |
1210 clearEventLogs(); | 1210 clearEventLogs(); |
1211 | 1211 |
1212 finishComposingText(); | 1212 finishComposingText(); |
(...skipping 17 matching lines...) Expand all Loading... | |
1230 waitAndVerifyUpdateSelection(1, 1, 1, -1, -1); | 1230 waitAndVerifyUpdateSelection(1, 1, 1, -1, -1); |
1231 // TODO(changwan): reduce the number of selection changes. | 1231 // TODO(changwan): reduce the number of selection changes. |
1232 waitForEventLogs("compositionupdate(a),input,compositionend(a),selection change," | 1232 waitForEventLogs("compositionupdate(a),input,compositionend(a),selection change," |
1233 + "selectionchange,selectionchange"); | 1233 + "selectionchange,selectionchange"); |
1234 } | 1234 } |
1235 | 1235 |
1236 @MediumTest | 1236 @MediumTest |
1237 @Feature({"TextInput"}) | 1237 @Feature({"TextInput"}) |
1238 public void testContentEditableEvents_CommitText() throws Throwable { | 1238 public void testContentEditableEvents_CommitText() throws Throwable { |
1239 focusElementAndWaitForStateUpdate("contenteditable_event"); | 1239 focusElementAndWaitForStateUpdate("contenteditable_event"); |
1240 waitForEventLogs("selectionchange,selectionchange"); | 1240 waitForEventLogs("selectionchange"); |
1241 clearEventLogs(); | 1241 clearEventLogs(); |
1242 | 1242 |
1243 commitText("a", 1); | 1243 commitText("a", 1); |
1244 waitAndVerifyUpdateSelection(0, 1, 1, -1, -1); | 1244 waitAndVerifyUpdateSelection(0, 1, 1, -1, -1); |
1245 | 1245 |
1246 waitForEventLogs("keydown(229),input,keyup(229),selectionchange"); | 1246 waitForEventLogs("keydown(229),input,keyup(229),selectionchange"); |
1247 } | 1247 } |
1248 | 1248 |
1249 @MediumTest | 1249 @MediumTest |
1250 @Feature({"TextInput"}) | 1250 @Feature({"TextInput"}) |
1251 public void testInputTextEvents_CommitText() throws Throwable { | 1251 public void testInputTextEvents_CommitText() throws Throwable { |
1252 commitText("a", 1); | 1252 commitText("a", 1); |
1253 waitAndVerifyUpdateSelection(0, 1, 1, -1, -1); | 1253 waitAndVerifyUpdateSelection(0, 1, 1, -1, -1); |
1254 | 1254 |
1255 waitForEventLogs("keydown(229),input,keyup(229),selectionchange"); | 1255 waitForEventLogs("keydown(229),input,keyup(229),selectionchange"); |
1256 } | 1256 } |
1257 | 1257 |
1258 @MediumTest | 1258 @MediumTest |
1259 @Feature({"TextInput"}) | 1259 @Feature({"TextInput"}) |
1260 public void testContentEditableEvents_DeleteSurroundingText() throws Throwab le { | 1260 public void testContentEditableEvents_DeleteSurroundingText() throws Throwab le { |
1261 focusElementAndWaitForStateUpdate("contenteditable_event"); | 1261 focusElementAndWaitForStateUpdate("contenteditable_event"); |
1262 waitForEventLogs("selectionchange,selectionchange"); | 1262 waitForEventLogs("selectionchange"); |
1263 clearEventLogs(); | 1263 clearEventLogs(); |
1264 | 1264 |
1265 commitText("hello", 1); | 1265 commitText("hello", 1); |
1266 waitAndVerifyUpdateSelection(0, 5, 5, -1, -1); | 1266 waitAndVerifyUpdateSelection(0, 5, 5, -1, -1); |
1267 waitForEventLogs("keydown(229),input,keyup(229),selectionchange"); | 1267 waitForEventLogs("keydown(229),input,keyup(229),selectionchange"); |
1268 clearEventLogs(); | 1268 clearEventLogs(); |
1269 | 1269 |
1270 setSelection(2, 2); | 1270 setSelection(2, 2); |
1271 waitAndVerifyUpdateSelection(1, 2, 2, -1, -1); | 1271 waitAndVerifyUpdateSelection(1, 2, 2, -1, -1); |
1272 waitForEventLogs("selectionchange"); | 1272 waitForEventLogs("selectionchange"); |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1806 public void onViewAttachedToWindow() { | 1806 public void onViewAttachedToWindow() { |
1807 mFactory.onViewAttachedToWindow(); | 1807 mFactory.onViewAttachedToWindow(); |
1808 } | 1808 } |
1809 | 1809 |
1810 @Override | 1810 @Override |
1811 public void onViewDetachedFromWindow() { | 1811 public void onViewDetachedFromWindow() { |
1812 mFactory.onViewDetachedFromWindow(); | 1812 mFactory.onViewDetachedFromWindow(); |
1813 } | 1813 } |
1814 } | 1814 } |
1815 } | 1815 } |
OLD | NEW |