import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.UrlUtils;
-import org.chromium.content.browser.ContentView;
+import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
import org.chromium.content.browser.test.util.DOMUtils;
private TestAdapterInputConnection mConnection;
private ImeAdapter mImeAdapter;
- private ContentView mContentView;
+
+ private ContentViewCore mContentViewCore;
private TestCallbackHelperContainer mCallbackContainer;
private TestInputMethodManagerWrapper mInputMethodManagerWrapper;
launchContentShellWithUrl(DATA_URL);
assertTrue("Page failed to load", waitForActiveShellToBeDoneLoading());
+ mContentViewCore = getContentViewCore();
- mInputMethodManagerWrapper = new TestInputMethodManagerWrapper(getContentViewCore());
+ mInputMethodManagerWrapper = new TestInputMethodManagerWrapper(mContentViewCore);
getImeAdapter().setInputMethodManagerWrapper(mInputMethodManagerWrapper);
assertEquals(0, mInputMethodManagerWrapper.getShowSoftInputCounter());
- getContentViewCore().setAdapterInputConnectionFactory(
+ mContentViewCore.setAdapterInputConnectionFactory(
new TestAdapterInputConnectionFactory());
- mContentView = getActivity().getActiveContentView();
- mCallbackContainer = new TestCallbackHelperContainer(mContentView);
+ mCallbackContainer = new TestCallbackHelperContainer(mContentViewCore);
// TODO(aurimas) remove this wait once crbug.com/179511 is fixed.
assertWaitForPageScaleFactorMatch(2);
- assertTrue(
- DOMUtils.waitForNonZeroNodeBounds(mContentView, mCallbackContainer, "input_text"));
- DOMUtils.clickNode(this, mContentView, mCallbackContainer, "input_text");
+ assertTrue(DOMUtils.waitForNonZeroNodeBounds(
+ mContentViewCore, "input_text"));
+ DOMUtils.clickNode(this, mContentViewCore, "input_text");
assertWaitForKeyboardStatus(true);
mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
commitText(mConnection, "hello", 1);
waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "hello", 5, 5, -1, -1);
- DOMUtils.clickNode(this, mContentView, mCallbackContainer, "input_radio");
+ DOMUtils.clickNode(this, mContentViewCore, "input_radio");
assertWaitForKeyboardStatus(false);
- DOMUtils.clickNode(this, mContentView, mCallbackContainer, "input_text");
+ DOMUtils.clickNode(this, mContentViewCore, "input_text");
assertWaitForKeyboardStatus(true);
assertEquals(5, mInputMethodManagerWrapper.getEditorInfo().initialSelStart);
assertEquals(5, mInputMethodManagerWrapper.getEditorInfo().initialSelEnd);
@SmallTest
@Feature({"TextInput", "Main"})
public void testShowImeIfNeeded() throws Throwable {
- DOMUtils.focusNode(this, mContentView, mCallbackContainer, "input_radio");
+ DOMUtils.focusNode(mContentViewCore, "input_radio");
assertWaitForKeyboardStatus(false);
performShowImeIfNeeded();
assertWaitForKeyboardStatus(false);
- DOMUtils.focusNode(this, mContentView, mCallbackContainer, "input_text");
+ DOMUtils.focusNode(mContentViewCore, "input_text");
assertWaitForKeyboardStatus(false);
performShowImeIfNeeded();
@Feature({"TextInput", "Main"})
public void testFinishComposingText() throws Throwable {
// Focus the textarea. We need to do the following steps because we are focusing using JS.
- DOMUtils.focusNode(this, mContentView, mCallbackContainer, "input_radio");
+ DOMUtils.focusNode(mContentViewCore, "input_radio");
assertWaitForKeyboardStatus(false);
- DOMUtils.focusNode(this, mContentView, mCallbackContainer, "textarea");
+ DOMUtils.focusNode(mContentViewCore, "textarea");
assertWaitForKeyboardStatus(false);
performShowImeIfNeeded();
assertWaitForKeyboardStatus(true);
@Feature({"TextInput", "Main"})
public void testEnterKeyEventWhileComposingText() throws Throwable {
// Focus the textarea. We need to do the following steps because we are focusing using JS.
- DOMUtils.focusNode(this, mContentView, mCallbackContainer, "input_radio");
+ DOMUtils.focusNode(mContentViewCore, "input_radio");
assertWaitForKeyboardStatus(false);
- DOMUtils.focusNode(this, mContentView, mCallbackContainer, "textarea");
+ DOMUtils.focusNode(mContentViewCore, "textarea");
assertWaitForKeyboardStatus(false);
performShowImeIfNeeded();
assertWaitForKeyboardStatus(true);
ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override
public void run() {
- mContentView.getContentViewCore().showImeIfNeeded();
+ mContentViewCore.showImeIfNeeded();
}
});
}
}
private ImeAdapter getImeAdapter() {
- return getContentViewCore().getImeAdapterForTest();
+ return mContentViewCore.getImeAdapterForTest();
}
private AdapterInputConnection getAdapterInputConnection() {
- return getContentViewCore().getInputConnectionForTest();
+ return mContentViewCore.getInputConnectionForTest();
}
private void copy(final ImeAdapter adapter) {