summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/test/xpcshell/test_getresource.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-06-26 16:09:08 -0400
committerMatt A. Tobin <email@mattatobin.com>2018-06-26 16:09:08 -0400
commiteda567b364a06e9e63efb865a6b1c73f1cb5232e (patch)
tree912ab15d877f733318e2c0394713bca33b830547 /toolkit/mozapps/extensions/test/xpcshell/test_getresource.js
parent80eb356d57fc310cdf812cae63de30d6e56c1788 (diff)
downloadUXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar
UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.gz
UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.lz
UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.xz
UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.zip
[AllAM] Remove Mozilla Tests
Diffstat (limited to 'toolkit/mozapps/extensions/test/xpcshell/test_getresource.js')
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_getresource.js94
1 files changed, 0 insertions, 94 deletions
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_getresource.js b/toolkit/mozapps/extensions/test/xpcshell/test_getresource.js
deleted file mode 100644
index 4dce15aec..000000000
--- a/toolkit/mozapps/extensions/test/xpcshell/test_getresource.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// install.rdf size, icon.png size, subfile.txt size
-const ADDON_SIZE = 672 + 15 + 26;
-
-// This verifies the functionality of getResourceURI
-// There are two cases - with a filename it returns an nsIFileURL to the filename
-// and with no parameters, it returns an nsIFileURL to the root of the addon
-
-function run_test() {
- do_test_pending();
- createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
-
- startupManager();
-
- AddonManager.getInstallForFile(do_get_addon("test_getresource"), function(aInstall) {
- do_check_true(aInstall.addon.hasResource("install.rdf"));
- do_check_eq(aInstall.addon.getResourceURI().spec, aInstall.sourceURI.spec);
-
- do_check_true(aInstall.addon.hasResource("icon.png"));
- do_check_eq(aInstall.addon.getResourceURI("icon.png").spec,
- "jar:" + aInstall.sourceURI.spec + "!/icon.png");
-
- do_check_false(aInstall.addon.hasResource("missing.txt"));
-
- do_check_true(aInstall.addon.hasResource("subdir/subfile.txt"));
- do_check_eq(aInstall.addon.getResourceURI("subdir/subfile.txt").spec,
- "jar:" + aInstall.sourceURI.spec + "!/subdir/subfile.txt");
-
- do_check_false(aInstall.addon.hasResource("subdir/missing.txt"));
-
- do_check_eq(aInstall.addon.size, ADDON_SIZE);
-
- completeAllInstalls([aInstall], function() {
- restartManager();
- AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
- do_check_neq(a1, null);
-
- let addonDir = gProfD.clone();
- addonDir.append("extensions");
- let rootUri = do_get_addon_root_uri(addonDir, "addon1@tests.mozilla.org");
-
- let uri = a1.getResourceURI("/");
- do_check_eq(uri.spec, rootUri);
-
- let file = rootUri + "install.rdf";
- do_check_true(a1.hasResource("install.rdf"));
- uri = a1.getResourceURI("install.rdf")
- do_check_eq(uri.spec, file);
-
- file = rootUri + "icon.png";
- do_check_true(a1.hasResource("icon.png"));
- uri = a1.getResourceURI("icon.png")
- do_check_eq(uri.spec, file);
-
- do_check_false(a1.hasResource("missing.txt"));
-
- file = rootUri + "subdir/subfile.txt";
- do_check_true(a1.hasResource("subdir/subfile.txt"));
- uri = a1.getResourceURI("subdir/subfile.txt")
- do_check_eq(uri.spec, file);
-
- do_check_false(a1.hasResource("subdir/missing.txt"));
-
- do_check_eq(a1.size, ADDON_SIZE);
-
- a1.uninstall();
-
- try {
- // hasResource should never throw an exception.
- do_check_false(a1.hasResource("icon.png"));
- } catch (e) {
- do_check_true(false);
- }
-
- AddonManager.getInstallForFile(do_get_addon("test_getresource"),
- callback_soon(function(aInstall) {
- do_check_false(a1.hasResource("icon.png"));
- do_check_true(aInstall.addon.hasResource("icon.png"));
-
- restartManager();
-
- AddonManager.getAddonByID("addon1@tests.mozilla.org", function(newa1) {
- do_check_eq(newa1, null);
-
- do_execute_soon(do_test_finished);
- });
- }));
- });
- });
- });
-}