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

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

Issue 2299913003: Allow some InputConnection methods to be called on UI thread (Closed)
Patch Set: bring back cache approach Created 4 years, 3 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/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 c931600cd206190a7f6b75ae2c69beb930b47502..ac45465abe36e349327577729f892354eafedadc 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
@@ -1350,6 +1350,30 @@ public class ImeTest extends ContentShellTestBase {
waitAndVerifyUpdateSelection(0, 7, 7, -1, -1);
}
+ // crbug.com/643477
+ @MediumTest
+ @Feature({"TextInput"})
+ public void testUiThreadAccess() throws Exception {
+ final ChromiumBaseInputConnection connection = mConnection;
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ // We allow UI thread access for most functions, except for
+ // beginBatchEdit(), endBatchEdit(), and get* methods().
+ assertTrue(connection.commitText("a", 1));
+ assertTrue(connection.setComposingText("b", 1));
+ assertTrue(connection.setComposingText("bc", 1));
+ assertTrue(connection.finishComposingText());
+ }
+ });
+ assertEquals("abc", runBlockingOnImeThread(new Callable<CharSequence>() {
+ @Override
+ public CharSequence call() throws Exception {
+ return connection.getTextBeforeCursor(5, 0);
+ }
+ }));
+ }
+
private void performGo(TestCallbackHelperContainer testCallbackHelperContainer)
throws Throwable {
final InputConnection inputConnection = mConnection;

Powered by Google App Engine
This is Rietveld 408576698