| Index: content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreSelectionTest.java
|
| diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreSelectionTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreSelectionTest.java
|
| index 419383f0bf7f87a044b369500f75d953842739b9..e945b760ac69e240d5fe2f5cc53d4f0b98f157c7 100644
|
| --- a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreSelectionTest.java
|
| +++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreSelectionTest.java
|
| @@ -15,11 +15,14 @@ import android.text.TextUtils;
|
| import org.chromium.base.ThreadUtils;
|
| import org.chromium.base.test.util.Feature;
|
| import org.chromium.base.test.util.UrlUtils;
|
| +import org.chromium.content.browser.input.ChromiumBaseInputConnection;
|
| 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_shell_apk.ContentShellTestBase;
|
|
|
| +import java.util.concurrent.Callable;
|
| +
|
| /**
|
| * Integration tests for text selection-related behavior.
|
| */
|
| @@ -424,12 +427,25 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| assertEquals(mContentViewCore.getSelectedText(), "SampleTextArea");
|
| hideSelectActionMode();
|
| waitForSelectActionBarVisible(false);
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollForCriteria(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| - return "SampleTextArea".equals(mContentViewCore.getImeAdapterForTest()
|
| - .getInputConnectionForTest()
|
| - .getTextBeforeCursor(50, 0));
|
| + final ChromiumBaseInputConnection connection =
|
| + mContentViewCore.getImeAdapterForTest().getInputConnectionForTest();
|
| + try {
|
| + CharSequence result = connection.getThreadManager().runBlockingForTesting(
|
| + new Callable<CharSequence>() {
|
| + @Override
|
| + public CharSequence call() throws Exception {
|
| + return connection.getTextBeforeCursor(50, 0);
|
| + }
|
| + });
|
| + return "SampleTextArea".equals(result);
|
| + } catch (Exception e) {
|
| + e.printStackTrace();
|
| + fail();
|
| + return false;
|
| + }
|
| }
|
| });
|
| }
|
|
|