summaryrefslogtreecommitdiffstats
path: root/mobile/android/tests/browser/robocop/testJavascriptBridge.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /mobile/android/tests/browser/robocop/testJavascriptBridge.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'mobile/android/tests/browser/robocop/testJavascriptBridge.js')
-rw-r--r--mobile/android/tests/browser/robocop/testJavascriptBridge.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/mobile/android/tests/browser/robocop/testJavascriptBridge.js b/mobile/android/tests/browser/robocop/testJavascriptBridge.js
new file mode 100644
index 000000000..3bfd89f88
--- /dev/null
+++ b/mobile/android/tests/browser/robocop/testJavascriptBridge.js
@@ -0,0 +1,52 @@
+var java = new JavaBridge(this);
+var javaResponded = false;
+
+do_register_cleanup(() => {
+ java.disconnect();
+});
+do_test_pending();
+
+function check_js_int_arg(int1) {
+ // Sync call from Java
+ do_check_eq(int1, 1);
+ java.asyncCall("checkJavaIntArg", 2);
+}
+
+function check_js_double_arg(double3) {
+ // Sync call from Java
+ do_check_eq(double3, 3.0);
+ java.asyncCall("checkJavaDoubleArg", 4.0);
+}
+
+function check_js_boolean_arg(boolfalse) {
+ // Sync call from Java
+ do_check_eq(boolfalse, false);
+ java.asyncCall("checkJavaBooleanArg", true);
+}
+
+function check_js_string_arg(stringfoo) {
+ do_check_eq(stringfoo, "foo");
+ java.asyncCall("checkJavaStringArg", "bar");
+}
+
+function check_js_object_arg(obj) {
+ // Sync call from Java
+ do_check_eq(obj.caller, "java");
+ java.asyncCall("checkJavaObjectArg", {caller: "js"});
+}
+
+function check_js_sync_call() {
+ // Sync call from Java
+ java.syncCall("doJSSyncCall");
+ // respond_to_js_sync_call should have run by now because
+ // do_js_sync_call calls it from Java code
+ do_check_true(javaResponded);
+
+ java.asyncCall("checkJSSyncCallReceived");
+ // End of test
+ do_test_finished();
+}
+
+function respond_to_js_sync_call() {
+ javaResponded = true;
+}