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

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: removed ImeTest#testDoesNotHang_rendererCrashes which does not test anything 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..5a261393e8b74119584e36bb03272088e15aef65 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,15 @@ 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.input.ImeTestUtils;
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.
*/
@@ -410,6 +414,18 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
assertEquals(mContentViewCore.getSelectedText(), "SampleTextArea");
}
+ private CharSequence getTextBeforeCursor(final int length, final int flags) {
+ final ChromiumBaseInputConnection connection =
+ mContentViewCore.getImeAdapterForTest().getInputConnectionForTest();
+ return ImeTestUtils.runBlockingOnHandlerNoException(
+ connection.getHandler(), new Callable<CharSequence>() {
+ @Override
+ public CharSequence call() throws Exception {
+ return connection.getTextBeforeCursor(length, flags);
+ }
+ });
+ }
+
@SmallTest
@Feature({"TextSelection", "TextInput"})
public void testCursorPositionAfterHidingActionMode() throws Exception {
@@ -423,12 +439,10 @@ 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));
+ return "SampleTextArea".equals(getTextBeforeCursor(50, 0));
}
});
}

Powered by Google App Engine
This is Rietveld 408576698