Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(841)

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java

Issue 534343002: Adding Paste Popup behavior Unit Test cases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Realigned the test cases. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
index c6e54ba4483752467c153bbec2880e064ccc95e3..3e5a69932f2d32588b3715cb1c3ee739fc83ded3 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
@@ -244,6 +244,80 @@ public class ImeTest extends ContentShellTestBase {
@SmallTest
@Feature({"TextInput"})
+ public void testPastePopupNotShownOnLongPressingNonEmptyInput() throws Throwable {
+ DOMUtils.focusNode(mContentViewCore, "input_text");
jdduke (slow) 2014/09/03 18:08:07 This behavior is only tangentially related to IME
AKVT 2014/09/03 19:23:16 Thanks for the suggestion, I had corrected it and
+ commitText(mConnection, "Sample Text", 1);
+ selectAll(mImeAdapter);
+ cut(mImeAdapter);
+ DOMUtils.focusNode(mContentViewCore, "textarea");
+ commitText(mConnection, "Sample Text", 1);
+ DOMUtils.longPressNode(this, mContentViewCore, "input_text");
+ assertWaitForPastePopupStatus(true);
+ DOMUtils.longPressNode(this, mContentViewCore, "textarea");
+ assertWaitForSelectActionBarStatus(true);
+ assertWaitForPastePopupStatus(false);
+ }
+
+ @SmallTest
+ @Feature({"TextInput"})
+ public void testPastePopupClearedOnTappingEmptyInput() throws Throwable {
+ DOMUtils.focusNode(mContentViewCore, "input_text");
+ commitText(mConnection, "Sample Text", 1);
+ selectAll(mImeAdapter);
+ cut(mImeAdapter);
+ DOMUtils.longPressNode(this, mContentViewCore, "input_text");
+ assertWaitForPastePopupStatus(true);
+ DOMUtils.clickNode(this, mContentViewCore, "input_text");
+ assertWaitForKeyboardStatus(true);
+ assertWaitForPastePopupStatus(false);
+ }
+
+ @SmallTest
+ @Feature({"TextInput"})
+ public void testPastePopupClearedOnTappingNonEmptyInput() throws Throwable {
+ DOMUtils.focusNode(mContentViewCore, "input_text");
+ commitText(mConnection, "Sample Text", 1);
+ selectAll(mImeAdapter);
+ cut(mImeAdapter);
+ DOMUtils.focusNode(mContentViewCore, "textarea");
+ commitText(mConnection, "Sample Text", 1);
+ DOMUtils.longPressNode(this, mContentViewCore, "input_text");
+ assertWaitForPastePopupStatus(true);
+ DOMUtils.clickNode(this, mContentViewCore, "input_text");
+ assertWaitForKeyboardStatus(true);
+ assertWaitForPastePopupStatus(false);
+ }
+
+ @SmallTest
+ @Feature({"TextInput"})
+ public void testPastePopupClearedOnTappingOutsideInput() throws Throwable {
+ DOMUtils.focusNode(mContentViewCore, "input_text");
+ assertWaitForKeyboardStatus(true);
+ commitText(mConnection, "Sample Text", 1);
+ selectAll(mImeAdapter);
+ cut(mImeAdapter);
+ DOMUtils.longPressNode(this, mContentViewCore, "input_text");
+ assertWaitForPastePopupStatus(true);
+ DOMUtils.clickNode(this, mContentViewCore, "input_radio");
+ assertWaitForPastePopupStatus(false);
+ }
+
+ @SmallTest
+ @Feature({"TextInput"})
+ public void testPastePopupClearedOnLongPressingOutsideInput() throws Throwable {
+ DOMUtils.focusNode(mContentViewCore, "input_text");
+ assertWaitForKeyboardStatus(true);
+ commitText(mConnection, "Sample Text", 1);
+ selectAll(mImeAdapter);
+ cut(mImeAdapter);
+ DOMUtils.longPressNode(this, mContentViewCore, "input_text");
+ assertWaitForPastePopupStatus(true);
+ DOMUtils.longPressNode(this, mContentViewCore, "input_radio");
+ assertWaitForPastePopupStatus(false);
+ }
+
+ @SmallTest
+ @Feature({"TextInput"})
public void testImeCut() throws Exception {
commitText(mConnection, "snarful", 1);
waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "snarful", 7, 7, -1, -1);
@@ -664,6 +738,15 @@ public class ImeTest extends ContentShellTestBase {
}));
}
+ private void assertWaitForPastePopupStatus(final boolean show) throws InterruptedException {
+ assertTrue(CriteriaHelper.pollForCriteria(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ return show == mContentViewCore.getPastePopupForTest().isShowing();
+ }
+ }));
+ }
+
private void waitAndVerifyEditableCallback(final ArrayList<TestImeState> states,
final int index, String text, int selectionStart, int selectionEnd,
int compositionStart, int compositionEnd) throws InterruptedException {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698