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.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
8 import android.app.Activity; | 8 import android.app.Activity; |
9 import android.content.ClipData; | 9 import android.content.ClipData; |
10 import android.content.ClipboardManager; | 10 import android.content.ClipboardManager; |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 assertWaitForSelectActionBarStatus(false); | 778 assertWaitForSelectActionBarStatus(false); |
779 } | 779 } |
780 | 780 |
781 @SmallTest | 781 @SmallTest |
782 @Feature({"TextInput"}) | 782 @Feature({"TextInput"}) |
783 public void testSelectActionBarClearedOnTappingOutsideInput() throws Excepti
on { | 783 public void testSelectActionBarClearedOnTappingOutsideInput() throws Excepti
on { |
784 commitText("Sample Text", 1); | 784 commitText("Sample Text", 1); |
785 DOMUtils.longPressNode(mContentViewCore, "input_text"); | 785 DOMUtils.longPressNode(mContentViewCore, "input_text"); |
786 assertWaitForKeyboardStatus(true); | 786 assertWaitForKeyboardStatus(true); |
787 assertWaitForSelectActionBarStatus(true); | 787 assertWaitForSelectActionBarStatus(true); |
788 DOMUtils.clickNode(mContentViewCore, "plain_text"); | 788 DOMUtils.clickNode(mContentViewCore, "input_radio"); |
789 assertWaitForKeyboardStatus(false); | 789 assertWaitForKeyboardStatus(false); |
790 assertWaitForSelectActionBarStatus(false); | 790 assertWaitForSelectActionBarStatus(false); |
791 } | 791 } |
792 | 792 |
793 @SmallTest | 793 @SmallTest |
794 @Feature({"TextInput"}) | 794 @Feature({"TextInput"}) |
795 public void testImeNotShownOnLongPressingDifferentEmptyInputs() throws Excep
tion { | 795 public void testImeNotShownOnLongPressingDifferentEmptyInputs() throws Excep
tion { |
796 DOMUtils.focusNode(mWebContents, "input_radio"); | 796 DOMUtils.focusNode(mWebContents, "input_radio"); |
797 DOMUtils.longPressNode(mContentViewCore, "input_text"); | 797 DOMUtils.longPressNode(mContentViewCore, "input_text"); |
798 assertWaitForKeyboardStatus(false); | 798 assertWaitForKeyboardStatus(false); |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 public void testRestartInputKeepsTextAndCursor() throws Exception { | 1310 public void testRestartInputKeepsTextAndCursor() throws Exception { |
1311 commitText("ab", 2); | 1311 commitText("ab", 2); |
1312 restartInput(); | 1312 restartInput(); |
1313 assertEquals("ab", getTextBeforeCursor(10, 0)); | 1313 assertEquals("ab", getTextBeforeCursor(10, 0)); |
1314 } | 1314 } |
1315 | 1315 |
1316 @MediumTest | 1316 @MediumTest |
1317 @Feature({"TextInput"}) | 1317 @Feature({"TextInput"}) |
1318 public void testContentEditableEvents_ComposingText() throws Throwable { | 1318 public void testContentEditableEvents_ComposingText() throws Throwable { |
1319 focusElementAndWaitForStateUpdate("contenteditable_event"); | 1319 focusElementAndWaitForStateUpdate("contenteditable_event"); |
1320 waitForEventLogs("selectionchange"); | 1320 waitForEventLogs("selectionchange,selectionchange"); |
1321 clearEventLogs(); | 1321 clearEventLogs(); |
1322 | 1322 |
1323 setComposingText("a", 1); | 1323 setComposingText("a", 1); |
1324 waitAndVerifyUpdateSelection(0, 1, 1, 0, 1); | 1324 waitAndVerifyUpdateSelection(0, 1, 1, 0, 1); |
1325 // TODO(changwan): reduce the number of selection changes. | 1325 // TODO(changwan): reduce the number of selection changes. |
1326 waitForEventLogs("keydown(229),compositionstart(),compositionupdate(a),i
nput,keyup(229)," | 1326 waitForEventLogs("keydown(229),compositionstart(),compositionupdate(a),i
nput,keyup(229)," |
1327 + "selectionchange,selectionchange"); | 1327 + "selectionchange,selectionchange"); |
1328 clearEventLogs(); | 1328 clearEventLogs(); |
1329 | 1329 |
1330 finishComposingText(); | 1330 finishComposingText(); |
(...skipping 14 matching lines...) Expand all Loading... |
1345 | 1345 |
1346 finishComposingText(); | 1346 finishComposingText(); |
1347 waitAndVerifyUpdateSelection(1, 1, 1, -1, -1); | 1347 waitAndVerifyUpdateSelection(1, 1, 1, -1, -1); |
1348 waitForEventLogs("compositionend(a)"); | 1348 waitForEventLogs("compositionend(a)"); |
1349 } | 1349 } |
1350 | 1350 |
1351 @MediumTest | 1351 @MediumTest |
1352 @Feature({"TextInput"}) | 1352 @Feature({"TextInput"}) |
1353 public void testContentEditableEvents_CommitText() throws Throwable { | 1353 public void testContentEditableEvents_CommitText() throws Throwable { |
1354 focusElementAndWaitForStateUpdate("contenteditable_event"); | 1354 focusElementAndWaitForStateUpdate("contenteditable_event"); |
1355 waitForEventLogs("selectionchange"); | 1355 waitForEventLogs("selectionchange,selectionchange"); |
1356 clearEventLogs(); | 1356 clearEventLogs(); |
1357 | 1357 |
1358 commitText("a", 1); | 1358 commitText("a", 1); |
1359 waitAndVerifyUpdateSelection(0, 1, 1, -1, -1); | 1359 waitAndVerifyUpdateSelection(0, 1, 1, -1, -1); |
1360 | 1360 |
1361 waitForEventLogs("keydown(229),input,keyup(229),selectionchange"); | 1361 waitForEventLogs("keydown(229),input,keyup(229),selectionchange"); |
1362 } | 1362 } |
1363 | 1363 |
1364 @MediumTest | 1364 @MediumTest |
1365 @Feature({"TextInput"}) | 1365 @Feature({"TextInput"}) |
1366 public void testInputTextEvents_CommitText() throws Throwable { | 1366 public void testInputTextEvents_CommitText() throws Throwable { |
1367 commitText("a", 1); | 1367 commitText("a", 1); |
1368 waitAndVerifyUpdateSelection(0, 1, 1, -1, -1); | 1368 waitAndVerifyUpdateSelection(0, 1, 1, -1, -1); |
1369 | 1369 |
1370 waitForEventLogs("keydown(229),input,keyup(229),selectionchange"); | 1370 waitForEventLogs("keydown(229),input,keyup(229),selectionchange"); |
1371 } | 1371 } |
1372 | 1372 |
1373 @MediumTest | 1373 @MediumTest |
1374 @Feature({"TextInput"}) | 1374 @Feature({"TextInput"}) |
1375 public void testContentEditableEvents_DeleteSurroundingText() throws Throwab
le { | 1375 public void testContentEditableEvents_DeleteSurroundingText() throws Throwab
le { |
1376 focusElementAndWaitForStateUpdate("contenteditable_event"); | 1376 focusElementAndWaitForStateUpdate("contenteditable_event"); |
1377 waitForEventLogs("selectionchange"); | 1377 waitForEventLogs("selectionchange,selectionchange"); |
1378 clearEventLogs(); | 1378 clearEventLogs(); |
1379 | 1379 |
1380 commitText("hello", 1); | 1380 commitText("hello", 1); |
1381 waitAndVerifyUpdateSelection(0, 5, 5, -1, -1); | 1381 waitAndVerifyUpdateSelection(0, 5, 5, -1, -1); |
1382 waitForEventLogs("keydown(229),input,keyup(229),selectionchange"); | 1382 waitForEventLogs("keydown(229),input,keyup(229),selectionchange"); |
1383 clearEventLogs(); | 1383 clearEventLogs(); |
1384 | 1384 |
1385 setSelection(2, 2); | 1385 setSelection(2, 2); |
1386 waitAndVerifyUpdateSelection(1, 2, 2, -1, -1); | 1386 waitAndVerifyUpdateSelection(1, 2, 2, -1, -1); |
1387 waitForEventLogs("selectionchange"); | 1387 waitForEventLogs("selectionchange"); |
(...skipping 21 matching lines...) Expand all Loading... |
1409 deleteSurroundingText(1, 1); | 1409 deleteSurroundingText(1, 1); |
1410 waitAndVerifyUpdateSelection(2, 1, 1, -1, -1); | 1410 waitAndVerifyUpdateSelection(2, 1, 1, -1, -1); |
1411 // TODO(yabinh): It should only fire 1 input and 1 selectionchange event
s. | 1411 // TODO(yabinh): It should only fire 1 input and 1 selectionchange event
s. |
1412 waitForEventLogs("keydown(229),input,input,keyup(229),selectionchange,se
lectionchange"); | 1412 waitForEventLogs("keydown(229),input,input,keyup(229),selectionchange,se
lectionchange"); |
1413 } | 1413 } |
1414 | 1414 |
1415 @MediumTest | 1415 @MediumTest |
1416 @Feature({"TextInput"}) | 1416 @Feature({"TextInput"}) |
1417 public void testContentEditableEvents_DeleteSurroundingTextInCodePoints() th
rows Throwable { | 1417 public void testContentEditableEvents_DeleteSurroundingTextInCodePoints() th
rows Throwable { |
1418 focusElementAndWaitForStateUpdate("contenteditable_event"); | 1418 focusElementAndWaitForStateUpdate("contenteditable_event"); |
1419 waitForEventLogs("selectionchange"); | 1419 waitForEventLogs("selectionchange,selectionchange"); |
1420 clearEventLogs(); | 1420 clearEventLogs(); |
1421 | 1421 |
1422 commitText("hello", 1); | 1422 commitText("hello", 1); |
1423 waitAndVerifyUpdateSelection(0, 5, 5, -1, -1); | 1423 waitAndVerifyUpdateSelection(0, 5, 5, -1, -1); |
1424 waitForEventLogs("keydown(229),input,keyup(229),selectionchange"); | 1424 waitForEventLogs("keydown(229),input,keyup(229),selectionchange"); |
1425 clearEventLogs(); | 1425 clearEventLogs(); |
1426 | 1426 |
1427 setSelection(2, 2); | 1427 setSelection(2, 2); |
1428 waitAndVerifyUpdateSelection(1, 2, 2, -1, -1); | 1428 waitAndVerifyUpdateSelection(1, 2, 2, -1, -1); |
1429 waitForEventLogs("selectionchange"); | 1429 waitForEventLogs("selectionchange"); |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1977 public void onViewAttachedToWindow() { | 1977 public void onViewAttachedToWindow() { |
1978 mFactory.onViewAttachedToWindow(); | 1978 mFactory.onViewAttachedToWindow(); |
1979 } | 1979 } |
1980 | 1980 |
1981 @Override | 1981 @Override |
1982 public void onViewDetachedFromWindow() { | 1982 public void onViewDetachedFromWindow() { |
1983 mFactory.onViewDetachedFromWindow(); | 1983 mFactory.onViewDetachedFromWindow(); |
1984 } | 1984 } |
1985 } | 1985 } |
1986 } | 1986 } |
OLD | NEW |