Bug 741972 - Test failures on ESR when channel is set to ESR, TEST-UNEXPECTED-FAIL | test_AddonRepository_compatmode.js | compatmode-strict@tests.mozilla.org == compatmode-ignore@tests.mozilla.org and more. Change tests to re-use the new AddonManager.checkCompatibility attribute for future-proofing channel additions/changes. r=bmcbride

This commit is contained in:
Mark Banner 2012-04-17 10:24:24 +01:00
Родитель 3cd1485d61
Коммит 8b458e354e
13 изменённых файлов: 32 добавлений и 168 удалений

Просмотреть файл

@ -16,23 +16,8 @@ function end_test() {
add_test(function() {
info("Testing compatibility checking warning");
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
var version = "nightly";
}
else {
version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1");
}
var pref = "extensions.checkCompatibility." + version;
info("Setting " + pref + " pref to false")
Services.prefs.setBoolPref(pref, false);
info("Setting checkCompatibility to false");
AddonManager.checkCompatibility = false;
open_manager("addons://list/extension", function(aWindow) {
var hbox = aWindow.document.querySelector("#list-view hbox.global-warning-checkcompatibility");

Просмотреть файл

@ -19,22 +19,6 @@ var gProvider;
var gServer;
var gAddonInstalled = false;
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
var version = "nightly";
}
else {
version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1");
}
const COMPATIBILITY_PREF = "extensions.checkCompatibility." + version;
function test() {
requestLongerTimeout(2);
// Turn on searching for this test
@ -608,7 +592,7 @@ add_test(function() {
// Tests that incompatible add-ons are shown with a warning if compatibility checking is disabled
add_test(function() {
Services.prefs.setBoolPref(COMPATIBILITY_PREF, false);
AddonManager.checkCompatiblity = false;
search("incompatible", false, function() {
var item = get_addon_item("remote5");
is_element_visible(item, "Incompatible addon should be visible");
@ -617,7 +601,7 @@ add_test(function() {
var item = get_addon_item("remote6");
is(item, null, "Addon incompatible with the product should not be visible");
Services.prefs.clearUserPref(COMPATIBILITY_PREF);
AddonManager.checkCompatiblity = true;
run_next_test();
});
});

Просмотреть файл

@ -26,6 +26,10 @@ var gAddonsList;
var TEST_UNPACKED = false;
function isNightlyChannel(channel) {
return channel != "aurora" && channel != "beta" && channel != "release" && channel != "esr";
}
function createAppInfo(id, name, version, platformVersion) {
gAppInfo = {
// nsIXULAppInfo

Просмотреть файл

@ -15,19 +15,6 @@ function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
} catch (e) { }
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
var version = "nightly";
} else {
version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1");
}
COMPATIBILITY_PREF = "extensions.checkCompatibility." + version;
// Create and configure the HTTP server.
gServer = new nsHttpServer();
gServer.registerDirectory("/data/", do_get_file("data"));
@ -84,7 +71,7 @@ function run_test_2() {
// Compatibility checking disabled.
function run_test_3() {
do_print("Testing with all compatibility checking disabled");
Services.prefs.setBoolPref(COMPATIBILITY_PREF, false);
AddonManager.checkCompatibility = false;
AddonRepository.searchAddons("test", 6, {
searchSucceeded: function(aAddons) {

Просмотреть файл

@ -38,21 +38,8 @@
// Disables security checking our updates which haven't been signed
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
// Disables compatibility checking
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", false);
}
else {
Services.prefs.setBoolPref("extensions.checkCompatibility.2", false);
}
AddonManager.checkCompatibility = false;
var ADDONS = [
"test_bug470377_1",

Просмотреть файл

@ -102,21 +102,8 @@ function run_test_1() {
}
function run_test_2() {
// Disable compatibility checks
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
AddonManager.checkCompatibility = false;
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", false);
}
else {
Services.prefs.setBoolPref("extensions.checkCompatibility.2.2", false);
}
restartManager();
AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",

Просмотреть файл

@ -101,21 +101,8 @@ function run_test_1() {
}
function run_test_2() {
// Disable compatibility checks
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
AddonManager.checkCompatibility = false;
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", false);
}
else {
Services.prefs.setBoolPref("extensions.checkCompatibility.2.2", false);
}
restartManager();
AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",

Просмотреть файл

@ -36,21 +36,6 @@
* ***** END LICENSE BLOCK *****
*/
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
var checkCompatPref = "extensions.checkCompatibility.nightly";
}
else {
checkCompatPref = "extensions.checkCompatibility.2.1a";
}
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2.1a4", "2");
@ -88,8 +73,8 @@ function run_test() {
}
function run_test_1() {
// Disable compatibility checks
Services.prefs.setBoolPref(checkCompatPref, false);
AddonManager.checkCompatibility = false;
startupManager();
AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",
@ -114,8 +99,8 @@ function run_test_1() {
}
function run_test_2() {
// Enable compatibility checks
Services.prefs.setBoolPref(checkCompatPref, true);
AddonManager.checkCompatibility = true;
restartManager();
AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",

Просмотреть файл

@ -41,8 +41,7 @@ const ID = "bug521905@tests.mozilla.org";
// Disables security checking our updates which haven't been signed
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
// Disables compatibility checking
Services.prefs.setBoolPref("extensions.checkCompatibility.2.0pre", false);
AddonManager.checkCompatibility = false;
function run_test() {
var channel = "default";
@ -53,9 +52,7 @@ function run_test() {
// This test is only relevant on builds where the version is included in the
// checkCompatibility preference name
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
if (isNightlyChannel(channel)) {
return;
}

Просмотреть файл

@ -59,8 +59,6 @@ var ADDONS = [{
const profileDir = gProfD.clone();
profileDir.append("extensions");
var gIsNightly = false;
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2.2.3", "2");
@ -69,16 +67,6 @@ function run_test() {
writeInstallRDFForExtension(a, profileDir);
});
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
gIsNightly = channel != "aurora" &&
channel != "beta" &&
channel != "release";
startupManager();
run_test_1();
@ -145,10 +133,8 @@ function run_test_1() {
// Tests that with compatibility checking disabled we see the incompatible
// add-ons enabled
function run_test_2() {
if (gIsNightly)
Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", false);
else
Services.prefs.setBoolPref("extensions.checkCompatibility.2.2", false);
AddonManager.checkCompatibility = false;
restartManager();
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
@ -166,8 +152,14 @@ function run_test_2() {
// Tests that with compatibility checking disabled we see the incompatible
// add-ons enabled.
function run_test_3() {
if (!gIsNightly)
Services.prefs.setBoolPref("extensions.checkCompatibility.2.1a", false);
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
if (!isNightlyChannel(channel))
AddonManager.checkCompatibility = false;
restartManager("2.1a4");
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
@ -185,10 +177,8 @@ function run_test_3() {
// Tests that with compatibility checking enabled we see the incompatible
// add-ons disabled.
function run_test_4() {
if (gIsNightly)
Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", true);
else
Services.prefs.setBoolPref("extensions.checkCompatibility.2.1a", true);
AddonManager.checkCompatibility = true;
restartManager();
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",

Просмотреть файл

@ -132,9 +132,7 @@ function run_test() {
try {
channel = Services.prefs.getCharPref("app.update.channel");
} catch (e) { }
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
if (isNightlyChannel(channel)) {
var version = "nightly";
} else {
version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1");

Просмотреть файл

@ -14,25 +14,10 @@ var testserver;
const profileDir = gProfD.clone();
profileDir.append("extensions");
var COMPATIBILITY_PREF;
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
} catch (e) { }
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
var version = "nightly";
} else {
version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1");
}
COMPATIBILITY_PREF = "extensions.checkCompatibility." + version;
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));
@ -174,7 +159,7 @@ function run_test_3() {
// Compatibility checking disabled.
function run_test_4() {
do_print("Testing with all compatibility checking disabled");
Services.prefs.setBoolPref(COMPATIBILITY_PREF, false);
AddonManager.checkCompatibility = false;
AddonManager.getAddonByID("compatmode-ignore@tests.mozilla.org", function(addon) {
do_check_neq(addon, null);
addon.findUpdates({

Просмотреть файл

@ -6,24 +6,12 @@
Components.utils.import("resource://gre/modules/AddonUpdateChecker.jsm");
var COMPATIBILITY_PREF;
do_load_httpd_js();
var testserver;
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
} catch (e) { }
if (channel != "aurora" && channel != "beta" && channel != "release")
var version = "nightly";
else
version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1");
COMPATIBILITY_PREF = "extensions.checkCompatibility." + version;
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));