Bug 1447903: Part 21 - Update test_bug455906.js to use only bootstrapped extensions. r=aswan

MozReview-Commit-ID: 33f7WNFP5bT

--HG--
extra : rebase_source : cb753fc249f8ee1c0b92185ce16633e796d37842
This commit is contained in:
Kris Maglione 2018-03-22 00:12:48 -07:00
Родитель 9bedb88982
Коммит 63f6285516
2 изменённых файлов: 8 добавлений и 11 удалений

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

@ -73,15 +73,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "aomStartup",
"@mozilla.org/addons/addon-manager-startup;1", "@mozilla.org/addons/addon-manager-startup;1",
"amIAddonManagerStartup"); "amIAddonManagerStartup");
// Whitelist existing tests that still use non-restartless extensions.
const LEGACY_NON_RESTARTLESS_TESTS = new Set([
"test_bug455906.js",
]);
if (LEGACY_NON_RESTARTLESS_TESTS.has(_TEST_FILE[0].replace(/.*\//, ""))) {
Services.prefs.setBoolPref("extensions.legacy.non-restartless.enabled", true);
}
const { const {
awaitPromise, awaitPromise,
createAppInfo, createAppInfo,

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

@ -5,12 +5,15 @@
const URI_EXTENSION_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul"; const URI_EXTENSION_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul";
ChromeUtils.import("resource://gre/modules/ExtensionUtils.jsm");
ChromeUtils.import("resource://testing-common/httpd.js"); ChromeUtils.import("resource://testing-common/httpd.js");
ChromeUtils.import("resource://testing-common/MockRegistrar.jsm"); ChromeUtils.import("resource://testing-common/MockRegistrar.jsm");
var gTestserver = new HttpServer(); var gTestserver = new HttpServer();
gTestserver.start(-1); gTestserver.start(-1);
gPort = gTestserver.identity.primaryPort; gPort = gTestserver.identity.primaryPort;
const {promiseObserved} = ExtensionUtils;
// register static files with server and interpolate port numbers in them // register static files with server and interpolate port numbers in them
mapFile("/data/bug455906_warn.xml", gTestserver); mapFile("/data/bug455906_warn.xml", gTestserver);
mapFile("/data/bug455906_start.xml", gTestserver); mapFile("/data/bug455906_start.xml", gTestserver);
@ -166,6 +169,7 @@ function create_addon(addon) {
" <Description about=\"urn:mozilla:install-manifest\">\n" + " <Description about=\"urn:mozilla:install-manifest\">\n" +
" <em:id>" + addon.id + "</em:id>\n" + " <em:id>" + addon.id + "</em:id>\n" +
" <em:version>" + addon.version + "</em:version>\n" + " <em:version>" + addon.version + "</em:version>\n" +
" <em:bootstrap>true</em:bootstrap>\n" +
" <em:targetApplication>\n" + " <em:targetApplication>\n" +
" <Description>\n" + " <Description>\n" +
" <em:id>xpcshell@tests.mozilla.org</em:id>\n" + " <em:id>xpcshell@tests.mozilla.org</em:id>\n" +
@ -371,7 +375,7 @@ function run_test_pt3() {
function check_notification_pt3(args) { function check_notification_pt3(args) {
dump("Checking notification pt 3\n"); dump("Checking notification pt 3\n");
Assert.equal(args.list.length, 6); Assert.equal(args.list.length, 3);
for (let addon of args.list) { for (let addon of args.list) {
if (addon.item instanceof Ci.nsIPluginTag) { if (addon.item instanceof Ci.nsIPluginTag) {
@ -446,7 +450,8 @@ function check_test_pt3() {
// Back to starting state // Back to starting state
gNotificationCheck = null; gNotificationCheck = null;
gTestCheck = run_test_pt4; gTestCheck = null;
promiseObserved("blocklist-updated").then(run_test_pt4);
load_blocklist("bug455906_start.xml"); load_blocklist("bug455906_start.xml");
}); });
} }
@ -459,6 +464,7 @@ function run_test_pt4() {
check_initial_state(function() { check_initial_state(function() {
gNotificationCheck = check_notification_pt4; gNotificationCheck = check_notification_pt4;
gTestCheck = check_test_pt4; gTestCheck = check_test_pt4;
promiseObserved("blocklist-updated").then(check_test_pt4);
load_blocklist("bug455906_empty.xml"); load_blocklist("bug455906_empty.xml");
}); });
})); }));