Bug 637413 - Always use a blank blocklist.xml file in the addon manager tests so we aren't broken by blocklist file updates. r=mossop a=blocker

This commit is contained in:
Joe Drew 2011-03-01 11:58:59 -05:00
Родитель 13df36f1ff
Коммит 68b2239829
9 изменённых файлов: 44 добавлений и 16 удалений

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

@ -1062,6 +1062,21 @@ gTmpD.append("temp");
gTmpD.create(AM_Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
registerDirectory("TmpD", gTmpD);
// Write out an empty blocklist.xml file to the profile to ensure nothing
// is blocklisted by default
var blockFile = gProfD.clone();
blockFile.append("blocklist.xml");
var stream = AM_Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(AM_Ci.nsIFileOutputStream);
stream.init(blockFile, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_TRUNCATE,
FileUtils.PERMS_FILE, 0);
var data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<blocklist xmlns=\"http://www.mozilla.org/2006/addons-blocklist\">\n" +
"</blocklist>\n";
stream.write(data, data.length);
stream.close();
do_register_cleanup(function() {
// Check that the temporary directory is empty
var dirEntries = gTmpD.directoryEntries

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

@ -40,6 +40,10 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
// We cannot force the blocklist to update so just copy our test list to the profile
var blocklistFile = gProfD.clone();
blocklistFile.append("blocklist.xml");
if (blocklistFile.exists())
blocklistFile.remove(false);
var source = do_get_file("data/test_bug393285.xml");
source.copyTo(gProfD, "blocklist.xml");

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

@ -40,6 +40,10 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
// We cannot force the blocklist to update so just copy our test list to the profile
var blocklistFile = gProfD.clone();
blocklistFile.append("blocklist.xml");
if (blocklistFile.exists())
blocklistFile.remove(false);
var source = do_get_file("data/test_bug393285.xml");
source.copyTo(gProfD, "blocklist.xml");

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

@ -117,21 +117,6 @@ function pathHandler(metadata, response) {
}
function run_test() {
// Write out an empty blocklist.xml file to the profile to ensure nothing
// is blocklisted by default
var blockFile = gProfD.clone();
blockFile.append("blocklist.xml");
var stream = AM_Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(AM_Ci.nsIFileOutputStream);
stream.init(blockFile, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_TRUNCATE,
FileUtils.PERMS_FILE, 0);
var data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<blocklist xmlns=\"http://www.mozilla.org/2006/addons-blocklist\">\n" +
"</blocklist>\n";
stream.write(data, data.length);
stream.close();
var osVersion;
var sysInfo = Components.classes["@mozilla.org/system-info;1"]
.getService(Components.interfaces.nsIPropertyBag2);

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

@ -257,6 +257,10 @@ function run_test() {
// Copy the initial blocklist into the profile to check add-ons start in the
// right state.
var blocklistFile = gProfD.clone();
blocklistFile.append("blocklist.xml");
if (blocklistFile.exists())
blocklistFile.remove(false);
var blocklist = do_get_file("data/bug455906_start.xml")
blocklist.copyTo(gProfD, "blocklist.xml");

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

@ -71,6 +71,10 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
// We cannot force the blocklist to update so just copy our test list to the profile
var blocklistFile = gProfD.clone();
blocklistFile.append("blocklist.xml");
if (blocklistFile.exists())
blocklistFile.remove(false);
var source = do_get_file("data/test_bug468528.xml");
source.copyTo(gProfD, "blocklist.xml");
@ -89,4 +93,4 @@ function run_test() {
// not blocked - the previous invalid regexp shouldn't act as a wildcard
do_check_true(blocklist.getPluginBlocklistState(PLUGINS[3], "1", "1.9") == nsIBLS.STATE_NOT_BLOCKED);
}
}

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

@ -74,6 +74,10 @@ var PLUGINS = [{
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
var blocklistFile = gProfD.clone();
blocklistFile.append("blocklist.xml");
if (blocklistFile.exists())
blocklistFile.remove(false);
var source = do_get_file("data/test_bug514327_1.xml");
source.copyTo(gProfD, "blocklist.xml");

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

@ -54,6 +54,10 @@ function get_test_plugintag() {
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
var blocklistFile = gProfD.clone();
blocklistFile.append("blocklist.xml");
if (blocklistFile.exists())
blocklistFile.remove(false);
var source = do_get_file("data/test_bug514327_2.xml");
source.copyTo(gProfD, "blocklist.xml");

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

@ -152,6 +152,10 @@ function run_test() {
// initialize the blocklist with no entries
var blocklistFile = gProfD.clone();
blocklistFile.append("blocklist.xml");
if (blocklistFile.exists())
blocklistFile.remove(false);
var source = do_get_file("data/test_bug514327_3_empty.xml");
source.copyTo(gProfD, "blocklist.xml");