Bug 1384829 - 4. Add test case to testInputConnection; r?esawin
Add a test case to testInputConnection that makes sure GeckoEditable's
Editable interface still behaves correctly even after disconnecting from
Gecko due to a blur.
MozReview-Commit-ID: 7Z6Kpv2tpRy
--- a/mobile/android/tests/browser/robocop/robocop_input.html
+++ b/mobile/android/tests/browser/robocop/robocop_input.html
@@ -242,16 +242,20 @@
},
focus_hiding_input: function(val) {
hiding_input.value = val;
hiding_input.style.display = "";
hiding_input.focus();
},
+ blur_hiding_input: function() {
+ hiding_input.blur();
+ },
+
finish_test: function() {
java.disconnect();
},
};
var java = new JavaBridge(test);
</script>
</body>
--- 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
@@ -459,14 +459,29 @@ public class testInputConnection extends
ic.commitText("foo", 1);
assertTextAndSelectionAt("Can commit text (hiding)", ic, "foo", 3);
ic.commitText("!", 1);
// The '!' key causes the input to hide in robocop_input.html,
// and there won't be a text/selection update as a result.
assertTextAndSelectionAt("Can handle hiding input", ic, "foo", 3);
+ // Bug 1401737, Editable does not behave correctly after disconnecting from Gecko.
+ getJS().syncCall("blur_hiding_input");
+ processGeckoEvents();
+ processInputConnectionEvents();
+
+ ic.setComposingRegion(0, 3);
+ ic.commitText("bar", 1);
+ assertTextAndSelectionAt("Can set spans/text after blur", ic, "bar", 3);
+
+ ic.commitText("baz", 1);
+ assertTextAndSelectionAt("Can remove spans after blur", ic, "barbaz", 6);
+
+ ic.setSelection(0, 3);
+ assertTextAndSelection("Can set selection after blur", ic, "barbaz", 0, 3);
+
// Make sure we don't leave behind stale events for the following test.
processGeckoEvents();
processInputConnectionEvents();
}
}
}