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 b85b48c3c3883918b9ed65f3d3110ae13753b2ed..01a600b589a85ed34183daca416e664231cf67d9 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,6 +27,7 @@ import org.chromium.content.browser.test.util.CriteriaHelper; |
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_public.browser.WebContents; |
import org.chromium.content_shell_apk.ContentShellTestBase; |
import java.util.ArrayList; |
@@ -51,6 +52,7 @@ public class ImeTest extends ContentShellTestBase { |
private ImeAdapter mImeAdapter; |
private ContentViewCore mContentViewCore; |
+ private WebContents mWebContents; |
private TestCallbackHelperContainer mCallbackContainer; |
private TestInputMethodManagerWrapper mInputMethodManagerWrapper; |
@@ -61,6 +63,7 @@ public class ImeTest extends ContentShellTestBase { |
launchContentShellWithUrl(DATA_URL); |
assertTrue("Page failed to load", waitForActiveShellToBeDoneLoading()); |
mContentViewCore = getContentViewCore(); |
+ mWebContents = getWebContents(); |
mInputMethodManagerWrapper = new TestInputMethodManagerWrapper(mContentViewCore); |
getImeAdapter().setInputMethodManagerWrapper(mInputMethodManagerWrapper); |
@@ -72,7 +75,7 @@ public class ImeTest extends ContentShellTestBase { |
// TODO(aurimas) remove this wait once crbug.com/179511 is fixed. |
assertWaitForPageScaleFactorMatch(2); |
assertTrue(DOMUtils.waitForNonZeroNodeBounds( |
- mContentViewCore, "input_text")); |
+ mWebContents, "input_text")); |
DOMUtils.clickNode(this, mContentViewCore, "input_text"); |
assertWaitForKeyboardStatus(true); |
@@ -179,7 +182,7 @@ public class ImeTest extends ContentShellTestBase { |
@SmallTest |
@Feature({"TextInput"}) |
public void testImeNotShownOnLongPressingEmptyInput() throws Exception { |
- DOMUtils.focusNode(mContentViewCore, "input_radio"); |
+ DOMUtils.focusNode(mWebContents, "input_radio"); |
DOMUtils.longPressNode(this, mContentViewCore, "input_text"); |
assertWaitForKeyboardStatus(false); |
commitText(mConnection, "Sample Text", 1); |
@@ -226,7 +229,7 @@ public class ImeTest extends ContentShellTestBase { |
@SmallTest |
@Feature({"TextInput"}) |
public void testImeNotShownOnLongPressingDifferentEmptyInputs() throws Exception { |
- DOMUtils.focusNode(mContentViewCore, "input_radio"); |
+ DOMUtils.focusNode(mWebContents, "input_radio"); |
DOMUtils.longPressNode(this, mContentViewCore, "input_text"); |
assertWaitForKeyboardStatus(false); |
DOMUtils.longPressNode(this, mContentViewCore, "textarea"); |
@@ -236,10 +239,10 @@ public class ImeTest extends ContentShellTestBase { |
@SmallTest |
@Feature({"TextInput"}) |
public void testImeStaysOnLongPressingDifferentNonEmptyInputs() throws Exception { |
- DOMUtils.focusNode(mContentViewCore, "input_text"); |
+ DOMUtils.focusNode(mWebContents, "input_text"); |
assertWaitForKeyboardStatus(true); |
commitText(mConnection, "Sample Text", 1); |
- DOMUtils.focusNode(mContentViewCore, "textarea"); |
+ DOMUtils.focusNode(mWebContents, "textarea"); |
commitText(mConnection, "Sample Text", 1); |
DOMUtils.longPressNode(this, mContentViewCore, "input_text"); |
assertWaitForKeyboardStatus(true); |
@@ -311,19 +314,19 @@ public class ImeTest extends ContentShellTestBase { |
public void testShowImeIfNeeded() throws Throwable { |
// showImeIfNeeded() is now implicitly called by the updated focus |
// heuristic so no need to call explicitly. http://crbug.com/371927 |
- DOMUtils.focusNode(mContentViewCore, "input_radio"); |
+ DOMUtils.focusNode(mWebContents, "input_radio"); |
assertWaitForKeyboardStatus(false); |
- DOMUtils.focusNode(mContentViewCore, "input_text"); |
+ DOMUtils.focusNode(mWebContents, "input_text"); |
assertWaitForKeyboardStatus(true); |
} |
@SmallTest |
@Feature({"TextInput", "Main"}) |
public void testFinishComposingText() throws Throwable { |
- DOMUtils.focusNode(mContentViewCore, "input_radio"); |
+ DOMUtils.focusNode(mWebContents, "input_radio"); |
assertWaitForKeyboardStatus(false); |
- DOMUtils.focusNode(mContentViewCore, "textarea"); |
+ DOMUtils.focusNode(mWebContents, "textarea"); |
assertWaitForKeyboardStatus(true); |
mConnection = (TestAdapterInputConnection) getAdapterInputConnection(); |
@@ -398,7 +401,7 @@ public class ImeTest extends ContentShellTestBase { |
@SmallTest |
@Feature({"TextInput", "Main"}) |
public void testKeyCodesWhileComposingText() throws Throwable { |
- DOMUtils.focusNode(mContentViewCore, "textarea"); |
+ DOMUtils.focusNode(mWebContents, "textarea"); |
assertWaitForKeyboardStatus(true); |
// The calls below are a reflection of what the stock Google Keyboard (Android 4.4) sends |
@@ -471,7 +474,7 @@ public class ImeTest extends ContentShellTestBase { |
*/ |
@DisabledTest |
public void testKeyCodesWhileSwipingText() throws Throwable { |
- DOMUtils.focusNode(mContentViewCore, "textarea"); |
+ DOMUtils.focusNode(mWebContents, "textarea"); |
assertWaitForKeyboardStatus(true); |
// The calls below are a reflection of what the stock Google Keyboard (Android 4.4) sends |
@@ -510,7 +513,7 @@ public class ImeTest extends ContentShellTestBase { |
@SmallTest |
@Feature({"TextInput", "Main"}) |
public void testKeyCodesWhileTypingText() throws Throwable { |
- DOMUtils.focusNode(mContentViewCore, "textarea"); |
+ DOMUtils.focusNode(mWebContents, "textarea"); |
assertWaitForKeyboardStatus(true); |
// The calls below are a reflection of what the Hacker's Keyboard sends when the noted |
@@ -592,7 +595,7 @@ public class ImeTest extends ContentShellTestBase { |
@SmallTest |
@Feature({"TextInput", "Main"}) |
public void testSetComposingRegionOutOfBounds() throws Throwable { |
- DOMUtils.focusNode(mContentViewCore, "textarea"); |
+ DOMUtils.focusNode(mWebContents, "textarea"); |
assertWaitForKeyboardStatus(true); |
mConnection = (TestAdapterInputConnection) getAdapterInputConnection(); |
@@ -610,9 +613,9 @@ public class ImeTest extends ContentShellTestBase { |
*/ |
@DisabledTest |
public void testEnterKeyEventWhileComposingText() throws Throwable { |
- DOMUtils.focusNode(mContentViewCore, "input_radio"); |
+ DOMUtils.focusNode(mWebContents, "input_radio"); |
assertWaitForKeyboardStatus(false); |
- DOMUtils.focusNode(mContentViewCore, "textarea"); |
+ DOMUtils.focusNode(mWebContents, "textarea"); |
assertWaitForKeyboardStatus(true); |
mConnection = (TestAdapterInputConnection) getAdapterInputConnection(); |
@@ -640,7 +643,7 @@ public class ImeTest extends ContentShellTestBase { |
@SmallTest |
@Feature({"TextInput", "Main"}) |
public void testDpadKeyCodesWhileSwipingText() throws Throwable { |
- DOMUtils.focusNode(mContentViewCore, "textarea"); |
+ DOMUtils.focusNode(mWebContents, "textarea"); |
assertWaitForKeyboardStatus(true); |
mConnection = (TestAdapterInputConnection) getAdapterInputConnection(); |
@@ -656,7 +659,7 @@ public class ImeTest extends ContentShellTestBase { |
@SmallTest |
@Feature({"TextInput", "Main"}) |
public void testTransitionsWhileComposingText() throws Throwable { |
- DOMUtils.focusNode(mContentViewCore, "textarea"); |
+ DOMUtils.focusNode(mWebContents, "textarea"); |
assertWaitForKeyboardStatus(true); |
mConnection = (TestAdapterInputConnection) getAdapterInputConnection(); |