summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/webextensions/test/xpcshell/test_pass_symbol.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-10 02:51:36 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-10 02:51:36 -0500
commit37d5300335d81cecbecc99812747a657588c63eb (patch)
tree765efa3b6a56bb715d9813a8697473e120436278 /toolkit/mozapps/webextensions/test/xpcshell/test_pass_symbol.js
parentb2bdac20c02b12f2057b9ef70b0a946113a00e00 (diff)
parent4fb11cd5966461bccc3ed1599b808237be6b0de9 (diff)
downloadUXP-37d5300335d81cecbecc99812747a657588c63eb.tar
UXP-37d5300335d81cecbecc99812747a657588c63eb.tar.gz
UXP-37d5300335d81cecbecc99812747a657588c63eb.tar.lz
UXP-37d5300335d81cecbecc99812747a657588c63eb.tar.xz
UXP-37d5300335d81cecbecc99812747a657588c63eb.zip
Merge branch 'ext-work'
Diffstat (limited to 'toolkit/mozapps/webextensions/test/xpcshell/test_pass_symbol.js')
-rw-r--r--toolkit/mozapps/webextensions/test/xpcshell/test_pass_symbol.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/toolkit/mozapps/webextensions/test/xpcshell/test_pass_symbol.js b/toolkit/mozapps/webextensions/test/xpcshell/test_pass_symbol.js
new file mode 100644
index 000000000..657601e45
--- /dev/null
+++ b/toolkit/mozapps/webextensions/test/xpcshell/test_pass_symbol.js
@@ -0,0 +1,43 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+const PASS_PREF = "symboltest.instanceid.pass";
+const FAIL_BOGUS_PREF = "symboltest.instanceid.fail_bogus";
+const FAIL_ID_PREF = "symboltest.instanceid.fail_bogus";
+const ADDON_ID = "test_symbol@tests.mozilla.org";
+
+createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
+startupManager();
+
+BootstrapMonitor.init();
+
+// symbol is passed when add-on is installed
+add_task(function*() {
+ for (let pref of [PASS_PREF, FAIL_BOGUS_PREF, FAIL_ID_PREF])
+ Services.prefs.clearUserPref(pref);
+
+ yield promiseInstallAllFiles([do_get_addon("test_symbol")], true);
+
+ let addon = yield promiseAddonByID(ADDON_ID);
+
+ do_check_neq(addon, null);
+ do_check_eq(addon.version, "1.0");
+ do_check_eq(addon.name, "Test Symbol");
+ do_check_true(addon.isCompatible);
+ do_check_false(addon.appDisabled);
+ do_check_true(addon.isActive);
+ do_check_eq(addon.type, "extension");
+
+ // most of the test is in bootstrap.js in the addon because BootstrapMonitor
+ // currently requires the objects in `data` to be serializable, and we
+ // need a real reference to the symbol to test this.
+ do_execute_soon(function() {
+ // give the startup time to run
+ do_check_true(Services.prefs.getBoolPref(PASS_PREF));
+ do_check_true(Services.prefs.getBoolPref(FAIL_BOGUS_PREF));
+ do_check_true(Services.prefs.getBoolPref(FAIL_ID_PREF));
+ });
+
+ yield promiseRestartManager();
+});