diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-10 02:51:36 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-10 02:51:36 -0500 |
commit | 37d5300335d81cecbecc99812747a657588c63eb (patch) | |
tree | 765efa3b6a56bb715d9813a8697473e120436278 /toolkit/mozapps/webextensions/test/xpcshell/test_bootstrap_resource.js | |
parent | b2bdac20c02b12f2057b9ef70b0a946113a00e00 (diff) | |
parent | 4fb11cd5966461bccc3ed1599b808237be6b0de9 (diff) | |
download | UXP-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_bootstrap_resource.js')
-rw-r--r-- | toolkit/mozapps/webextensions/test/xpcshell/test_bootstrap_resource.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/toolkit/mozapps/webextensions/test/xpcshell/test_bootstrap_resource.js b/toolkit/mozapps/webextensions/test/xpcshell/test_bootstrap_resource.js new file mode 100644 index 000000000..7b7883225 --- /dev/null +++ b/toolkit/mozapps/webextensions/test/xpcshell/test_bootstrap_resource.js @@ -0,0 +1,56 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +// Tests that resource protocol substitutions are set and unset for bootstrapped add-ons. + +const profileDir = gProfD.clone(); +profileDir.append("extensions"); + + +function run_test() { + do_test_pending(); + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2"); + + let resourceProtocol = Services.io.getProtocolHandler("resource") + .QueryInterface(Components.interfaces.nsIResProtocolHandler); + startupManager(); + + installAllFiles([do_get_addon("test_chromemanifest_6")], + function() { + + AddonManager.getAddonByID("addon6@tests.mozilla.org", function(addon) { + do_check_neq(addon, null); + do_check_true(addon.isActive); + do_check_true(resourceProtocol.hasSubstitution("test-addon-1")); + + prepare_test({ + "addon6@tests.mozilla.org": [ + ["onDisabling", false], + "onDisabled" + ] + }); + + do_check_eq(addon.operationsRequiringRestart & + AddonManager.OP_NEEDS_RESTART_DISABLE, 0); + addon.userDisabled = true; + ensure_test_completed(); + do_check_false(resourceProtocol.hasSubstitution("test-addon-1")) + + prepare_test({ + "addon6@tests.mozilla.org": [ + ["onEnabling", false], + "onEnabled" + ] + }); + + do_check_eq(addon.operationsRequiringRestart & + AddonManager.OP_NEEDS_RESTART_ENABLE, 0); + addon.userDisabled = false; + ensure_test_completed(); + do_check_true(resourceProtocol.hasSubstitution("test-addon-1")); + + do_execute_soon(do_test_finished); + }); + }); +} |