diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-11 07:03:16 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-11 07:03:16 -0500 |
commit | 203eb0f61a09372310a2a8fb57e169cb3f47800b (patch) | |
tree | 8490329d3dae4de3c7ffd127bce1f65fdc009abd /toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_resource.js | |
parent | e45706ca3acbb6530419433212becc61d5953a2d (diff) | |
parent | 8f6d3dab81c7f8f97ef197e26ab9439b09735b8f (diff) | |
download | UXP-203eb0f61a09372310a2a8fb57e169cb3f47800b.tar UXP-203eb0f61a09372310a2a8fb57e169cb3f47800b.tar.gz UXP-203eb0f61a09372310a2a8fb57e169cb3f47800b.tar.lz UXP-203eb0f61a09372310a2a8fb57e169cb3f47800b.tar.xz UXP-203eb0f61a09372310a2a8fb57e169cb3f47800b.zip |
Merge branch 'ext-work'FF_Checkpoint_1
Diffstat (limited to 'toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_resource.js')
-rw-r--r-- | toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_resource.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_resource.js b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_resource.js new file mode 100644 index 000000000..7b7883225 --- /dev/null +++ b/toolkit/mozapps/extensions/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); + }); + }); +} |