diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /toolkit/mozapps/extensions/test/xpcshell/test_install_icons.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-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 'toolkit/mozapps/extensions/test/xpcshell/test_install_icons.js')
-rw-r--r-- | toolkit/mozapps/extensions/test/xpcshell/test_install_icons.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_install_icons.js b/toolkit/mozapps/extensions/test/xpcshell/test_install_icons.js new file mode 100644 index 000000000..70f91c560 --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/test_install_icons.js @@ -0,0 +1,61 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +// use httpserver to find an available port +Components.utils.import("resource://testing-common/httpd.js"); +var gServer = new HttpServer(); +gServer.start(-1); +gPort = gServer.identity.primaryPort; + +var addon_url = "http://localhost:" + gPort + "/test.xpi"; +var icon32_url = "http://localhost:" + gPort + "/icon.png"; +var icon64_url = "http://localhost:" + gPort + "/icon64.png"; + +function run_test() { + do_test_pending(); + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); + startupManager(); + + test_1(); +} + +function test_1() { + AddonManager.getInstallForURL(addon_url, function(aInstall) { + do_check_eq(aInstall.iconURL, null); + do_check_neq(aInstall.icons, null); + do_check_eq(aInstall.icons[32], undefined); + do_check_eq(aInstall.icons[64], undefined); + test_2(); + }, "application/x-xpinstall", null, null, null, null, null); +} + +function test_2() { + AddonManager.getInstallForURL(addon_url, function(aInstall) { + do_check_eq(aInstall.iconURL, icon32_url); + do_check_neq(aInstall.icons, null); + do_check_eq(aInstall.icons[32], icon32_url); + do_check_eq(aInstall.icons[64], undefined); + test_3(); + }, "application/x-xpinstall", null, null, icon32_url, null, null); +} + +function test_3() { + AddonManager.getInstallForURL(addon_url, function(aInstall) { + do_check_eq(aInstall.iconURL, icon32_url); + do_check_neq(aInstall.icons, null); + do_check_eq(aInstall.icons[32], icon32_url); + do_check_eq(aInstall.icons[64], undefined); + test_4(); + }, "application/x-xpinstall", null, null, { "32": icon32_url }, null, null); +} + +function test_4() { + AddonManager.getInstallForURL(addon_url, function(aInstall) { + do_check_eq(aInstall.iconURL, icon32_url); + do_check_neq(aInstall.icons, null); + do_check_eq(aInstall.icons[32], icon32_url); + do_check_eq(aInstall.icons[64], icon64_url); + do_execute_soon(do_test_finished); + }, "application/x-xpinstall", null, null, { "32": icon32_url, "64": icon64_url }, null, null); +} |