| 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 4259e540ed8d1a01445dbe8cd7ba1d1a9f6c7d4b..65e8202f5847e975a8db38122d46e96688cbb061 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
|
| @@ -18,11 +18,11 @@ import android.view.inputmethod.EditorInfo;
|
|
|
| import org.chromium.base.ThreadUtils;
|
| import org.chromium.base.test.util.Feature;
|
| -import org.chromium.base.test.util.UrlUtils;
|
| 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;
|
| +import org.chromium.content.browser.test.util.JavaScriptUtils;
|
| 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;
|
| @@ -41,20 +41,6 @@ import java.util.concurrent.TimeoutException;
|
| * Integration tests for text input using cases based on fixed regressions.
|
| */
|
| public class ImeTest extends ContentShellTestBase {
|
| - private static final String DATA_URL = UrlUtils.encodeHtmlDataUri(
|
| - "<html><head><meta name=\"viewport\""
|
| - + "content=\"width=device-width\" /></head>"
|
| - + "<body><form action=\"about:blank\">"
|
| - + "<input id=\"input_text\" type=\"text\" /><br/></form><form>"
|
| - + "<br/><input id=\"input_radio\" type=\"radio\" style=\"width:50px;height:50px\" />"
|
| - + "<br/><textarea id=\"textarea\" rows=\"4\" cols=\"20\"></textarea>"
|
| - + "<br/><textarea id=\"textarea2\" rows=\"4\" cols=\"20\" autocomplete=\"off\">"
|
| - + "</textarea>"
|
| - + "<br/><input id=\"input_number1\" type=\"number\" /><br/>"
|
| - + "<br/><input id=\"input_number2\" type=\"number\" /><br/>"
|
| - + "<br/><p><span id=\"plain_text\">This is Plain Text One</span></p>"
|
| - + "</form></body></html>");
|
| -
|
| private TestAdapterInputConnection mConnection;
|
| private TestAdapterInputConnectionFactory mConnectionFactory;
|
| private ImeAdapter mImeAdapter;
|
| @@ -67,9 +53,8 @@ public class ImeTest extends ContentShellTestBase {
|
| @Override
|
| public void setUp() throws Exception {
|
| super.setUp();
|
| -
|
| - launchContentShellWithUrl(DATA_URL);
|
| - waitForActiveShellToBeDoneLoading();
|
| + startActivityWithTestUrl(
|
| + "content/test/data/android/ime/input_forms.html");
|
| mContentViewCore = getContentViewCore();
|
| mWebContents = getWebContents();
|
|
|
| @@ -393,7 +378,13 @@ public class ImeTest extends ContentShellTestBase {
|
| getInstrumentation().runOnMainSync(new Runnable() {
|
| @Override
|
| public void run() {
|
| - getActivity().getActiveShell().loadUrl(DATA_URL);
|
| + try {
|
| + startActivityWithTestUrl(
|
| + "content/test/data/android/ime/input_forms.html");
|
| + } catch (InterruptedException e) {
|
| + e.printStackTrace();
|
| + fail();
|
| + }
|
| }
|
| });
|
| // Depending on the timing, hideSoftInput and restartInput call counts may vary here
|
| @@ -1043,6 +1034,22 @@ public class ImeTest extends ContentShellTestBase {
|
| waitAndVerifyStatesAndCalls(5, "abefcd", 1, 1, -1, -1);
|
| }
|
|
|
| + @MediumTest
|
| + @Feature({"TextInput"})
|
| + public void testCommitTextTriggersCompositionEvents() throws Throwable {
|
| + focusElementAndWaitForStateUpdate("contenteditable0");
|
| + commitText("a", 1);
|
| + waitAndVerifyStatesAndCalls(0, "a", 1, 1, -1, -1);
|
| +
|
| + final String code = "getLogs()";
|
| + final String expectedLogs = "keydown(229),"
|
| + + "compositionstart(),"
|
| + + "compositionend(a),"
|
| + + "keyup(229),";
|
| + assertEquals('"' + expectedLogs + '"', JavaScriptUtils.executeJavaScriptAndWaitForResult(
|
| + getContentViewCore().getWebContents(), code));
|
| + }
|
| +
|
| private CharSequence getTextBeforeCursor(final int length, final int flags)
|
| throws ExecutionException {
|
| return ThreadUtils.runOnUiThreadBlocking(new Callable<CharSequence>() {
|
|
|