| 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 991b605d19aa56f6781c6887365109f86360eed7..e95e71b9b3adea526501668b7e4f5eed981ce6bd 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
|
| @@ -27,7 +27,6 @@
|
| import org.chromium.content.browser.test.util.DOMUtils;
|
| import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
|
| import org.chromium.content.browser.test.util.TestInputMethodManagerWrapper;
|
| -import org.chromium.content.browser.test.util.TestInputMethodManagerWrapper.Range;
|
| import org.chromium.content_public.browser.WebContents;
|
| import org.chromium.content_shell_apk.ContentShellTestBase;
|
|
|
| @@ -86,7 +85,7 @@
|
| mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
|
| mImeAdapter = getImeAdapter();
|
|
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| assertEquals(1, mInputMethodManagerWrapper.getShowSoftInputCounter());
|
| assertEquals(0, mInputMethodManagerWrapper.getEditorInfo().initialSelStart);
|
| assertEquals(0, mInputMethodManagerWrapper.getEditorInfo().initialSelEnd);
|
| @@ -96,11 +95,11 @@
|
| @Feature({"TextInput", "Main"})
|
| public void testKeyboardDismissedAfterClickingGo() throws Throwable {
|
| setComposingText(mConnection, "hello", 1);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 1, "hello", 5, 5, 0, 5);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "hello", 5, 5, 0, 5);
|
|
|
| performGo(getAdapterInputConnection(), mCallbackContainer);
|
|
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 2, "", 0, 0, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "", 0, 0, -1, -1);
|
| assertWaitForKeyboardStatus(false);
|
| }
|
|
|
| @@ -109,19 +108,19 @@
|
| @RerunWithUpdatedContainerView
|
| public void testGetTextUpdatesAfterEnteringText() throws Throwable {
|
| setComposingText(mConnection, "h", 1);
|
| - waitAndVerifyStates(mConnection.mImeUpdateQueue, 1, "h", 1, 1, 0, 1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "h", 1, 1, 0, 1);
|
| assertEquals(1, mInputMethodManagerWrapper.getShowSoftInputCounter());
|
|
|
| setComposingText(mConnection, "he", 1);
|
| - waitAndVerifyStates(mConnection.mImeUpdateQueue, 2, "he", 2, 2, 0, 2);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "he", 2, 2, 0, 2);
|
| assertEquals(1, mInputMethodManagerWrapper.getShowSoftInputCounter());
|
|
|
| setComposingText(mConnection, "hel", 1);
|
| - waitAndVerifyStates(mConnection.mImeUpdateQueue, 3, "hel", 3, 3, 0, 3);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 3, "hel", 3, 3, 0, 3);
|
| assertEquals(1, mInputMethodManagerWrapper.getShowSoftInputCounter());
|
|
|
| commitText(mConnection, "hel", 1);
|
| - waitAndVerifyStates(mConnection.mImeUpdateQueue, 4, "hel", 3, 3, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 4, "hel", 3, 3, -1, -1);
|
| assertEquals(1, mInputMethodManagerWrapper.getShowSoftInputCounter());
|
| }
|
|
|
| @@ -130,10 +129,10 @@
|
| @RerunWithUpdatedContainerView
|
| public void testImeCopy() throws Exception {
|
| commitText(mConnection, "hello", 1);
|
| - waitAndVerifyStates(mConnection.mImeUpdateQueue, 1, "hello", 5, 5, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "hello", 5, 5, -1, -1);
|
|
|
| setSelection(mConnection, 2, 5);
|
| - waitAndVerifyStates(mConnection.mImeUpdateQueue, 2, "hello", 2, 5, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "hello", 2, 5, -1, -1);
|
|
|
| copy(mImeAdapter);
|
| assertClipboardContents(getActivity(), "llo");
|
| @@ -143,7 +142,7 @@
|
| @Feature({"TextInput"})
|
| public void testEnterTextAndRefocus() throws Exception {
|
| commitText(mConnection, "hello", 1);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 1, "hello", 5, 5, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "hello", 5, 5, -1, -1);
|
|
|
| DOMUtils.clickNode(this, mContentViewCore, "input_radio");
|
| assertWaitForKeyboardStatus(false);
|
| @@ -158,7 +157,8 @@
|
| @Feature({"TextInput"})
|
| public void testKeyboardNotDismissedAfterCopySelection() throws Exception {
|
| commitText(mConnection, "Sample Text", 1);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 1, "Sample Text", 11, 11, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1,
|
| + "Sample Text", 11, 11, -1, -1);
|
| DOMUtils.clickNode(this, mContentViewCore, "input_text");
|
| assertWaitForKeyboardStatus(true);
|
| DOMUtils.longPressNode(this, mContentViewCore, "input_text");
|
| @@ -172,7 +172,8 @@
|
| @Feature({"TextInput"})
|
| public void testImeNotDismissedAfterCutSelection() throws Exception {
|
| commitText(mConnection, "Sample Text", 1);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 1, "Sample Text", 11, 11, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1,
|
| + "Sample Text", 11, 11, -1, -1);
|
| DOMUtils.longPressNode(this, mContentViewCore, "input_text");
|
| assertWaitForSelectActionBarStatus(true);
|
| assertWaitForKeyboardStatus(true);
|
| @@ -256,13 +257,13 @@
|
| @Feature({"TextInput"})
|
| public void testImeCut() throws Exception {
|
| commitText(mConnection, "snarful", 1);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 1, "snarful", 7, 7, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "snarful", 7, 7, -1, -1);
|
|
|
| setSelection(mConnection, 1, 5);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 2, "snarful", 1, 5, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "snarful", 1, 5, -1, -1);
|
|
|
| cut(mImeAdapter);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 3, "sul", 1, 1, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 3, "sul", 1, 1, -1, -1);
|
|
|
| assertClipboardContents(getActivity(), "narf");
|
| }
|
| @@ -281,18 +282,18 @@
|
| });
|
|
|
| paste(mImeAdapter);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 1, "blarg", 5, 5, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "blarg", 5, 5, -1, -1);
|
|
|
| setSelection(mConnection, 3, 5);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 2, "blarg", 3, 5, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "blarg", 3, 5, -1, -1);
|
|
|
| paste(mImeAdapter);
|
| // Paste is a two step process when there is a non-zero selection.
|
| - waitAndVerifyStates(mConnection.mImeUpdateQueue, 3, "bla", 3, 3, -1, -1);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 4, "blablarg", 8, 8, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 3, "bla", 3, 3, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 4, "blablarg", 8, 8, -1, -1);
|
|
|
| paste(mImeAdapter);
|
| - waitAndVerifyStatesAndCalls(
|
| + waitAndVerifyEditableCallback(
|
| mConnection.mImeUpdateQueue, 5, "blablargblarg", 13, 13, -1, -1);
|
| }
|
|
|
| @@ -300,13 +301,13 @@
|
| @Feature({"TextInput"})
|
| public void testImeSelectAndUnSelectAll() throws Exception {
|
| commitText(mConnection, "hello", 1);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 1, "hello", 5, 5, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "hello", 5, 5, -1, -1);
|
|
|
| selectAll(mImeAdapter);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 2, "hello", 0, 5, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "hello", 0, 5, -1, -1);
|
|
|
| unselect(mImeAdapter);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 3, "", 0, 0, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 3, "", 0, 0, -1, -1);
|
|
|
| assertWaitForKeyboardStatus(false);
|
| }
|
| @@ -342,25 +343,25 @@
|
| }));
|
|
|
| mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
|
|
| commitText(mConnection, "hllo", 1);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 1, "hllo", 4, 4, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "hllo", 4, 4, -1, -1);
|
|
|
| commitText(mConnection, " ", 1);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 2, "hllo ", 5, 5, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "hllo ", 5, 5, -1, -1);
|
|
|
| setSelection(mConnection, 1, 1);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 3, "hllo ", 1, 1, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 3, "hllo ", 1, 1, -1, -1);
|
|
|
| setComposingRegion(mConnection, 0, 4);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 4, "hllo ", 1, 1, 0, 4);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 4, "hllo ", 1, 1, 0, 4);
|
|
|
| finishComposingText(mConnection);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 5, "hllo ", 1, 1, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 5, "hllo ", 1, 1, -1, -1);
|
|
|
| commitText(mConnection, "\n", 1);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 6, "h\nllo ", 2, 2, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 6, "h\nllo ", 2, 2, -1, -1);
|
| }
|
|
|
| private int getTypedKeycodeGuess(String before, String after) {
|
| @@ -425,7 +426,7 @@
|
| // that the test reflects reality. If this test breaks, it's possible that code has
|
| // changed and different calls need to be made instead.
|
| mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
|
|
| // H
|
| expectUpdateStateCall(mConnection);
|
| @@ -499,7 +500,7 @@
|
| // that the test reflects reality. If this test breaks, it's possible that code has
|
| // changed and different calls need to be made instead.
|
| mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
|
|
| // "three"
|
| expectUpdateStateCall(mConnection);
|
| @@ -529,18 +530,28 @@
|
|
|
| @SmallTest
|
| @Feature({"TextInput", "Main"})
|
| - public void testDeleteMultiCharacterCodepoint() throws Throwable {
|
| + public void testBackspaceKeycode() throws Throwable {
|
| DOMUtils.focusNode(mWebContents, "textarea");
|
| assertWaitForKeyboardStatus(true);
|
|
|
| mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| -
|
| - // This smiley is a multi character codepoint.
|
| - final String smiley = "\uD83D\uDE0A";
|
| -
|
| - commitText(mConnection, smiley, 1);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 1, smiley, 2, 2, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| +
|
| + // H
|
| + expectUpdateStateCall(mConnection);
|
| + commitText(mConnection, "h", 1);
|
| + assertEquals(KeyEvent.KEYCODE_H, mImeAdapter.mLastSyntheticKeyCode);
|
| + assertEquals("h", mConnection.getTextBeforeCursor(9, 0));
|
| + assertUpdateStateCall(mConnection, 1000);
|
| + assertEquals("h", mConnection.getTextBeforeCursor(9, 0));
|
| +
|
| + // O
|
| + expectUpdateStateCall(mConnection);
|
| + commitText(mConnection, "o", 1);
|
| + assertEquals(KeyEvent.KEYCODE_O, mImeAdapter.mLastSyntheticKeyCode);
|
| + assertEquals("ho", mConnection.getTextBeforeCursor(9, 0));
|
| + assertUpdateStateCall(mConnection, 1000);
|
| + assertEquals("ho", mConnection.getTextBeforeCursor(9, 0));
|
|
|
| // DEL, sent via dispatchKeyEvent like it is in Android WebView or a physical keyboard.
|
| getInstrumentation().runOnMainSync(new Runnable() {
|
| @@ -553,51 +564,6 @@
|
| }
|
| });
|
|
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 2, "", 0, 0, -1, -1);
|
| -
|
| - // Make sure that we accept further typing after deleting the smiley.
|
| - setComposingText(mConnection, "s", 1);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 3, "s", 1, 1, 0, 1);
|
| - setComposingText(mConnection, "sm", 1);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 4, "sm", 2, 2, 0, 2);
|
| - }
|
| -
|
| - @SmallTest
|
| - @Feature({"TextInput", "Main"})
|
| - public void testBackspaceKeycode() throws Throwable {
|
| - DOMUtils.focusNode(mWebContents, "textarea");
|
| - assertWaitForKeyboardStatus(true);
|
| -
|
| - mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| -
|
| - // H
|
| - expectUpdateStateCall(mConnection);
|
| - commitText(mConnection, "h", 1);
|
| - assertEquals(KeyEvent.KEYCODE_H, mImeAdapter.mLastSyntheticKeyCode);
|
| - assertEquals("h", mConnection.getTextBeforeCursor(9, 0));
|
| - assertUpdateStateCall(mConnection, 1000);
|
| - assertEquals("h", mConnection.getTextBeforeCursor(9, 0));
|
| -
|
| - // O
|
| - expectUpdateStateCall(mConnection);
|
| - commitText(mConnection, "o", 1);
|
| - assertEquals(KeyEvent.KEYCODE_O, mImeAdapter.mLastSyntheticKeyCode);
|
| - assertEquals("ho", mConnection.getTextBeforeCursor(9, 0));
|
| - assertUpdateStateCall(mConnection, 1000);
|
| - assertEquals("ho", mConnection.getTextBeforeCursor(9, 0));
|
| -
|
| - // DEL, sent via dispatchKeyEvent like it is in Android WebView or a physical keyboard.
|
| - getInstrumentation().runOnMainSync(new Runnable() {
|
| - @Override
|
| - public void run() {
|
| - mContentViewCore.dispatchKeyEvent(
|
| - new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL));
|
| - mContentViewCore.dispatchKeyEvent(
|
| - new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL));
|
| - }
|
| - });
|
| -
|
| // DEL
|
| expectUpdateStateCall(mConnection);
|
| assertEquals("h", mConnection.getTextBeforeCursor(9, 0));
|
| @@ -612,7 +578,7 @@
|
| assertWaitForKeyboardStatus(true);
|
|
|
| mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
|
|
| // H
|
| expectUpdateStateCall(mConnection);
|
| @@ -662,7 +628,7 @@
|
| // key is touched on screen. Exercise care when altering to make sure that the test
|
| // reflects reality.
|
| mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
|
|
| // H
|
| expectUpdateStateCall(mConnection);
|
| @@ -741,7 +707,7 @@
|
| assertWaitForKeyboardStatus(true);
|
|
|
| mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
|
|
| // h
|
| dispatchKeyEvent(mConnection, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_H));
|
| @@ -821,7 +787,7 @@
|
| assertWaitForKeyboardStatus(true);
|
|
|
| mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| setComposingText(mConnection, "hello", 1);
|
|
|
| setComposingRegion(mConnection, 0, 0);
|
| @@ -848,10 +814,10 @@
|
| }));
|
|
|
| mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
|
|
| setComposingText(mConnection, "hello", 1);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 1, "hello", 5, 5, 0, 5);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "hello", 5, 5, 0, 5);
|
|
|
| getInstrumentation().runOnMainSync(new Runnable() {
|
| @Override
|
| @@ -863,13 +829,10 @@
|
| });
|
|
|
| // TODO(aurimas): remove this workaround when crbug.com/278584 is fixed.
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 2, "hello", 5, 5, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "hello", 5, 5, -1, -1);
|
| // The second new line is not a user visible/editable one, it is a side-effect of Blink
|
| // using <br> internally.
|
| - // TODO(changwan): [ 6, 6 ] is different from what we report to
|
| - // InputMethodManager#updateSelection().
|
| - // Uncomment this once it's fixed.
|
| - waitAndVerifyStates(mConnection.mImeUpdateQueue, 3, "hello\n\n", 6, 6, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 3, "hello\n\n", 6, 6, -1, -1);
|
| }
|
|
|
| @SmallTest
|
| @@ -879,7 +842,7 @@
|
| assertWaitForKeyboardStatus(true);
|
|
|
| mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
|
|
| // DPAD_CENTER should cause keyboard to appear
|
| expectUpdateStateCall(mConnection);
|
| @@ -895,7 +858,7 @@
|
| assertWaitForKeyboardStatus(true);
|
|
|
| mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
|
|
| // H
|
| // Since autocomplete="on" by default, COMPOSITION_KEY_CODE is emitted as key code
|
| @@ -919,7 +882,7 @@
|
| assertWaitForKeyboardStatus(true);
|
|
|
| mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
|
|
| // H
|
| // Although autocomplete="off", we still emit COMPOSITION_KEY_CODE since synthesized
|
| @@ -941,13 +904,13 @@
|
| @Feature({"TextInput"})
|
| public void testPastePopupShowOnLongPress() throws Throwable {
|
| commitText(mConnection, "hello", 1);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 1, "hello", 5, 5, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "hello", 5, 5, -1, -1);
|
|
|
| selectAll(mImeAdapter);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 2, "hello", 0, 5, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "hello", 0, 5, -1, -1);
|
|
|
| cut(mImeAdapter);
|
| - waitAndVerifyStatesAndCalls(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
| + waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
|
|
|
| DOMUtils.longPressNode(this, mContentViewCore, "input_text");
|
| final PastePopupMenu pastePopup = mContentViewCore.getPastePopupForTest();
|
| @@ -1011,11 +974,9 @@
|
| }));
|
| }
|
|
|
| - // TODO(changwan): replace calls to this by waitAndVerifyStatesAndCalls once
|
| - // we figure out why updateSelection is called with incorrect values.
|
| - private void waitAndVerifyStates(final ArrayList<TestImeState> states, final int index,
|
| - String text, final int selectionStart, final int selectionEnd,
|
| - final int compositionStart, final int compositionEnd) throws InterruptedException {
|
| + private void waitAndVerifyEditableCallback(final ArrayList<TestImeState> states,
|
| + final int index, String text, int selectionStart, int selectionEnd,
|
| + int compositionStart, int compositionEnd) throws InterruptedException {
|
| assertTrue(CriteriaHelper.pollForCriteria(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| @@ -1024,27 +985,6 @@
|
| }));
|
| states.get(index).assertEqualState(
|
| text, selectionStart, selectionEnd, compositionStart, compositionEnd);
|
| - }
|
| -
|
| - private void waitAndVerifyStatesAndCalls(final ArrayList<TestImeState> states, final int index,
|
| - String text, final int selectionStart, final int selectionEnd,
|
| - final int compositionStart, final int compositionEnd) throws InterruptedException {
|
| - waitAndVerifyStates(states, index, text, selectionStart, selectionEnd, compositionStart,
|
| - compositionEnd);
|
| -
|
| - // Wait and verify calls to InputMethodManager.
|
| - final Range selection = new Range(selectionStart, selectionEnd);
|
| - final Range composition = new Range(compositionStart, compositionEnd);
|
| - assertTrue("Actual selection was: " + mInputMethodManagerWrapper.getSelection()
|
| - + ", and actual composition was: "
|
| - + mInputMethodManagerWrapper.getComposition(),
|
| - CriteriaHelper.pollForCriteria(new Criteria() {
|
| - @Override
|
| - public boolean isSatisfied() {
|
| - return mInputMethodManagerWrapper.getSelection().equals(selection)
|
| - && mInputMethodManagerWrapper.getComposition().equals(composition);
|
| - }
|
| - }));
|
| }
|
|
|
| private void expectUpdateStateCall(final TestAdapterInputConnection connection) {
|
|
|