Bug 1277695 Skip tests that need signing if necessary r?kmag
MozReview-Commit-ID: ENfAEw5WSKg
--- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension_install.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension_install.js
@@ -1,44 +1,64 @@
+
+const {ADDON_SIGNING} = AM_Cu.import("resource://gre/modules/addons/AddonConstants.jsm", {});
+
function run_test() {
run_next_test();
}
let profileDir;
add_task(function* setup() {
profileDir = gProfD.clone();
profileDir.append("extensions");
+ if (!profileDir.exists())
+ profileDir.create(AM_Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
+
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
startupManager();
});
const IMPLICIT_ID_XPI = "data/webext-implicit-id.xpi";
const IMPLICIT_ID_ID = "webext_implicit_id@tests.mozilla.org";
// webext-implicit-id.xpi has a minimal manifest with no
// applications or browser_specific_settings, so its id comes
// from its signature, which should be the ID constant defined below.
add_task(function* test_implicit_id() {
+ // This test needs to read the xpi certificate which only works
+ // if signing is enabled. If it is not, skip the test...
+ if (!ADDON_SIGNING) {
+ do_print("Skipped implicit_id test since ADDON_SIGNING is disabled");
+ return;
+ }
+
let addon = yield promiseAddonByID(IMPLICIT_ID_ID);
do_check_eq(addon, null);
let xpifile = do_get_file(IMPLICIT_ID_XPI);
yield promiseInstallAllFiles([xpifile]);
addon = yield promiseAddonByID(IMPLICIT_ID_ID);
do_check_neq(addon, null);
addon.uninstall();
});
// We should also be able to install webext-implicit-id.xpi temporarily
// and it should look just like the regular install (ie, the ID should
// come from the signature)
add_task(function* test_implicit_id_temp() {
+ // This test needs to read the xpi certificate which only works
+ // if signing is enabled. If it is not, skip the test...
+ if (!ADDON_SIGNING) {
+ do_print("Skipped implicit_id_temp test since ADDON_SIGNING is disabled");
+ return;
+ }
+
let addon = yield promiseAddonByID(IMPLICIT_ID_ID);
do_check_eq(addon, null);
let xpifile = do_get_file(IMPLICIT_ID_XPI);
yield AddonManager.installTemporaryAddon(xpifile);
addon = yield promiseAddonByID(IMPLICIT_ID_ID);
do_check_neq(addon, null);