Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreSelectionTest.java

Issue 1278593004: Introduce ThreadedInputConnection behind a switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: switched to delayed onCreateInputConnection approach (tedchoc@'s other comments not resolved yet) Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 986718d6a80728d396094cda8cb8e09cb39d4376..bfee24be1ccc173c9d15486acf3709c0b06ebf75 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
@@ -14,11 +14,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.
*/
@@ -423,12 +426,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;
+ }
}
});
}

Powered by Google App Engine
This is Rietveld 408576698