mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
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:
parent
f79eb1e9b0
commit
fb787e7766
@ -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");
|
||||
@ -42,7 +27,7 @@ add_test(function() {
|
||||
|
||||
info("Clicking 'Enable' button");
|
||||
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
|
||||
is(Services.prefs.prefHasUserValue(pref), false, "Check Compatibility pref should be cleared");
|
||||
is(AddonManager.checkCompatibility, true, "Check Compatibility pref should be cleared");
|
||||
is_element_hidden(hbox, "Check Compatibility warning hbox should be hidden");
|
||||
is_element_hidden(button, "Check Compatibility warning button should be hidden");
|
||||
|
||||
|
@ -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
|
||||
@ -603,16 +587,16 @@ 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.checkCompatibility = false;
|
||||
search("incompatible", false, function() {
|
||||
var item = get_addon_item("remote5");
|
||||
is_element_visible(item, "Incompatible addon should be visible");
|
||||
is(item.getAttribute("notification"), "warning", "Compatibility warning should be shown");
|
||||
|
||||
var item = get_addon_item("remote6");
|
||||
item = get_addon_item("remote6");
|
||||
is(item, null, "Addon incompatible with the product should not be visible");
|
||||
|
||||
Services.prefs.clearUserPref(COMPATIBILITY_PREF);
|
||||
AddonManager.checkCompatibility = true;
|
||||
run_next_test();
|
||||
});
|
||||
});
|
||||
|
@ -26,6 +26,16 @@ var gAddonsList;
|
||||
|
||||
var TEST_UNPACKED = false;
|
||||
|
||||
function isNightlyChannel() {
|
||||
var channel = "default";
|
||||
try {
|
||||
channel = Services.prefs.getCharPref("app.update.channel");
|
||||
}
|
||||
catch (e) { }
|
||||
|
||||
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 HttpServer();
|
||||
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) {
|
||||
|
@ -5,21 +5,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",
|
||||
|
@ -69,21 +69,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",
|
||||
|
@ -68,21 +68,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",
|
||||
|
@ -3,21 +3,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
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");
|
||||
@ -55,8 +40,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",
|
||||
@ -81,8 +66,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",
|
||||
|
@ -8,21 +8,12 @@ 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";
|
||||
try {
|
||||
channel = Services.prefs.getCharPref("app.update.channel");
|
||||
}
|
||||
catch (e) { }
|
||||
|
||||
// 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()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -69,15 +69,7 @@ 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";
|
||||
gIsNightly = isNightlyChannel();
|
||||
|
||||
startupManager();
|
||||
|
||||
|
@ -128,13 +128,7 @@ function run_test() {
|
||||
|
||||
|
||||
// AddonManager.checkCompatibility
|
||||
var channel = "default";
|
||||
try {
|
||||
channel = Services.prefs.getCharPref("app.update.channel");
|
||||
} catch (e) { }
|
||||
if (channel != "aurora" &&
|
||||
channel != "beta" &&
|
||||
channel != "release") {
|
||||
if (isNightlyChannel()) {
|
||||
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 HttpServer();
|
||||
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;
|
||||
|
||||
Components.utils.import("resource://testing-common/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 HttpServer();
|
||||
testserver.registerDirectory("/data/", do_get_file("data"));
|
||||
|
Loading…
Reference in New Issue
Block a user