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 { |