diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoInputConnection.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoInputConnection.java index 549dd4a63c52..a80be0bce74a 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoInputConnection.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoInputConnection.java @@ -24,7 +24,6 @@ import android.content.res.Configuration; import android.graphics.Matrix; import android.graphics.RectF; import android.media.AudioManager; -import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.SystemClock; @@ -172,29 +171,6 @@ class GeckoInputConnection return true; } - @Override - public boolean performPrivateCommand(final String action, final Bundle data) { - switch (action) { - case "process-gecko-events": - // Process all currently pending Gecko thread events before returning. - - final Editable editable = getEditable(); - if (editable == null) { - return false; - } - - // Removing an invalid span is essentially a no-op, but it does force the - // current thread to wait for the Gecko thread when we call length(), in order - // to process the removeSpan event. Once Gecko thread processes the removeSpan - // event, all previous events in the Gecko event queue would have been - // processed as well. - editable.removeSpan(null); - editable.length(); - return true; - } - return false; - } - @Override public ExtractedText getExtractedText(ExtractedTextRequest req, int flags) { if (req == null) diff --git a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/components/GeckoViewComponent.java b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/components/GeckoViewComponent.java index 3d61c9cfd582..3beab3169a8f 100644 --- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/components/GeckoViewComponent.java +++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/components/GeckoViewComponent.java @@ -10,6 +10,7 @@ import static org.mozilla.gecko.tests.helpers.AssertionHelper.fAssertNotSame; import static org.mozilla.gecko.tests.helpers.AssertionHelper.fAssertSame; import static org.mozilla.gecko.tests.helpers.AssertionHelper.fAssertTrue; +import org.mozilla.gecko.GeckoThread; import org.mozilla.gecko.R; import org.mozilla.gecko.tests.UITestContext; import org.mozilla.gecko.tests.helpers.FrameworkHelper; @@ -118,12 +119,11 @@ public class GeckoViewComponent extends BaseComponent { * Processes pending events on the Gecko thread before returning. * Must be called on the input connection thread during a test. */ - protected void processGeckoEvents(final InputConnection ic) { + protected void processGeckoEvents() { fAssertSame("Should be called on input connection thread", Looper.myLooper(), inputConnectionHandler.getLooper()); - fAssertTrue("Should be able to process Gecko events", - ic.performPrivateCommand("process-gecko-events", null)); + GeckoThread.waitOnGecko(); } private static ExtractedText getExtractedText(final InputConnection ic) { diff --git a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testInputConnection.java b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testInputConnection.java index add82090b996..206c10f29492 100644 --- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testInputConnection.java +++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testInputConnection.java @@ -191,7 +191,7 @@ public class testInputConnection extends JavascriptBridgeTest { assertTextAndSelectionAt("Can set the composing text", ic, "bad", 3); getJS().asyncCall("test_reflush_changes"); // Wait for text change notifications to come in. - processGeckoEvents(ic); + processGeckoEvents(); assertTextAndSelectionAt("Can re-flush text changes", ic, "good", 4); ic.setComposingText("done", 1); assertTextAndSelectionAt("Can update composition after re-flushing", ic, "done", 4); @@ -206,7 +206,7 @@ public class testInputConnection extends JavascriptBridgeTest { assertTextAndSelectionAt("Can set the composing text", ic, "foobar", 6); getJS().asyncCall("test_set_selection"); // Wait for text change notifications to come in. - processGeckoEvents(ic); + processGeckoEvents(); assertTextAndSelectionAt("Can select after committing", ic, "foobar", 3); ic.setComposingText("barfoo", 1); assertTextAndSelectionAt("Can compose after selecting", ic, "barfoo", 6); @@ -244,7 +244,7 @@ public class testInputConnection extends JavascriptBridgeTest { assertTextAndSelectionAt("Can clear text", ic, "", 0); // Make sure we don't leave behind stale events for the following test. - processGeckoEvents(ic); + processGeckoEvents(); processInputConnectionEvents(); } } @@ -275,21 +275,21 @@ public class testInputConnection extends JavascriptBridgeTest { // and the input connection thread. Therefore, to ensure these events are // issued and to ensure the bug appears, we have to process all Gecko events, // then all input connection events, and finally all Gecko events again. - processGeckoEvents(ic); + processGeckoEvents(); processInputConnectionEvents(); - processGeckoEvents(ic); + processGeckoEvents(); assertTextAndSelectionAt("Can set composing region (resetting)", ic, "foo", 3); ic.setComposingText("foobar", 1); - processGeckoEvents(ic); + processGeckoEvents(); processInputConnectionEvents(); - processGeckoEvents(ic); + processGeckoEvents(); assertTextAndSelectionAt("Can change composing text (resetting)", ic, "foobar", 6); ic.setComposingText("baz", 1); - processGeckoEvents(ic); + processGeckoEvents(); processInputConnectionEvents(); - processGeckoEvents(ic); + processGeckoEvents(); assertTextAndSelectionAt("Can reset composing text (resetting)", ic, "baz", 3); ic.finishComposingText(); @@ -299,7 +299,7 @@ public class testInputConnection extends JavascriptBridgeTest { assertTextAndSelectionAt("Can clear text", ic, "", 0); // Make sure we don't leave behind stale events for the following test. - processGeckoEvents(ic); + processGeckoEvents(); processInputConnectionEvents(); } } @@ -329,7 +329,7 @@ public class testInputConnection extends JavascriptBridgeTest { assertTextAndSelectionAt("Can handle hiding input", ic, "foo", 3); // Make sure we don't leave behind stale events for the following test. - processGeckoEvents(ic); + processGeckoEvents(); processInputConnectionEvents(); } }