Bug 847863 - Part 1 of 8 - Selectively disable old Download Manager xpcshell tests. r=enn

This commit is contained in:
Paolo Amadini 2013-08-19 17:23:59 +02:00
parent 4979cc99bd
commit cffd53387c
21 changed files with 95 additions and 2 deletions

View File

@ -240,3 +240,12 @@ Services.prefs.setBoolPref("browser.download.manager.showAlertOnComplete", false
do_register_cleanup(function() {
Services.obs.notifyObservers(null, "quit-application", null);
});
function oldDownloadManagerDisabled() {
try {
if (Services.prefs.getBoolPref("browser.download.useJSTransfer")) {
return true;
}
} catch (ex) { }
return false;
}

View File

@ -39,6 +39,10 @@ var tests = [test_retry_canceled, test_retry_bad];
var httpserv = null;
function run_test()
{
if (oldDownloadManagerDisabled()) {
return;
}
httpserv = new HttpServer();
httpserv.registerDirectory("/", do_get_cwd());
httpserv.start(-1);

View File

@ -30,6 +30,10 @@ var httpserv = null;
var timer = null;
function run_test()
{
if (oldDownloadManagerDisabled()) {
return;
}
httpserv = new HttpServer();
httpserv.registerDirectory("/", do_get_cwd());
httpserv.start(-1);

View File

@ -76,6 +76,10 @@ function checkRecentDocsFor(aFileName) {
var httpserv = null;
function run_test()
{
if (oldDownloadManagerDisabled()) {
return;
}
// This test functionality only implemented on Windows.
// Is there a better way of doing this?
var httpPH = Cc["@mozilla.org/network/protocol;1?name=http"].

View File

@ -27,6 +27,10 @@ var tests = [test_noScanningDownloads];
function run_test()
{
if (oldDownloadManagerDisabled()) {
return;
}
for (var i = 0; i < tests.length; i++)
tests[i]();
}

View File

@ -9,6 +9,10 @@
function run_test()
{
if (oldDownloadManagerDisabled()) {
return;
}
let dm = Cc["@mozilla.org/download-manager;1"].
getService(Ci.nsIDownloadManager);
let db = dm.DBConnection;

View File

@ -9,6 +9,10 @@ importDownloadsFile("bug_409179_downloads.sqlite");
function run_test()
{
if (oldDownloadManagerDisabled()) {
return;
}
var caughtException = false;
try {
var dm = Cc["@mozilla.org/download-manager;1"].

View File

@ -10,6 +10,10 @@ const dm = Cc["@mozilla.org/download-manager;1"].getService(nsIDownloadManager);
function run_test()
{
if (oldDownloadManagerDisabled()) {
return;
}
// Don't finish until the download is finished
do_test_pending();

View File

@ -123,6 +123,10 @@ let tests = [
];
function run_test() {
if (oldDownloadManagerDisabled()) {
return;
}
// setup a download listener to run tests during and after the download
DownloadListener.init();
Services.prefs.setBoolPref("browser.download.manager.showWhenStarting", false);

View File

@ -96,6 +96,10 @@ var tests = [test_get_download_empty_queue, test_connection,
var httpserv = null;
function run_test()
{
if (oldDownloadManagerDisabled()) {
return;
}
httpserv = new HttpServer();
httpserv.registerDirectory("/", do_get_cwd());
httpserv.start(-1);

View File

@ -145,6 +145,10 @@ let tests = [
];
function run_test() {
if (oldDownloadManagerDisabled()) {
return;
}
// setup a download listener to run tests after each download finished
DownloadListener.init();
Services.prefs.setBoolPref("browser.download.manager.showWhenStarting", false);

View File

@ -6,6 +6,10 @@ const dm = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManage
function run_test()
{
if (oldDownloadManagerDisabled()) {
return;
}
let server = new HttpServer();
server.start(-1);
let dl = addDownload(server);

View File

@ -26,6 +26,10 @@ function getExpirablePRTime() {
function run_test()
{
if (oldDownloadManagerDisabled()) {
return;
}
run_next_test();
}

View File

@ -18,7 +18,9 @@ const nsIDM = Ci.nsIDownloadManager;
const nsIWBP = Ci.nsIWebBrowserPersist;
const nsIWPL = Ci.nsIWebProgressListener;
const dm = Cc["@mozilla.org/download-manager;1"].getService(nsIDM);
dm.cleanUp();
if (!oldDownloadManagerDisabled()) {
dm.cleanUp();
}
function setOnlineState(aOnline)
{
@ -36,6 +38,10 @@ function setOnlineState(aOnline)
function run_test()
{
if (oldDownloadManagerDisabled()) {
return;
}
/**
* 1. Create data for http server to send
*/

View File

@ -7,6 +7,10 @@
function run_test()
{
if (oldDownloadManagerDisabled()) {
return;
}
// Create the downloads.rdf file
importDownloadsFile("empty_downloads.rdf");

View File

@ -7,6 +7,10 @@
// Private resumed request sends times=1 cookie, completes
function run_test() {
if (oldDownloadManagerDisabled()) {
return;
}
// Allow all cookies.
Services.prefs.setIntPref("network.cookie.cookieBehavior", 0);

View File

@ -79,6 +79,10 @@ function is_download_available(aGUID, aSrc, aDst, aName, aPrivate, present) {
}
function run_test() {
if (oldDownloadManagerDisabled()) {
return;
}
let prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);

View File

@ -77,6 +77,10 @@ function trigger_pb_cleanup(expected)
}
function run_test() {
if (oldDownloadManagerDisabled()) {
return;
}
function finishTest() {
// Cancel Download-G
dlG.cancel();

View File

@ -155,6 +155,10 @@ let tests = [
function run_test()
{
if (oldDownloadManagerDisabled()) {
return;
}
for (let i = 0; i < tests.length; i++) {
dm.cleanUp();
tests[i]();

View File

@ -17,6 +17,10 @@ const dm = Cc["@mozilla.org/download-manager;1"].getService(nsIDM);
function run_test()
{
if (oldDownloadManagerDisabled()) {
return;
}
/**
* 1. Create data for http server to send
*/

View File

@ -18,7 +18,9 @@ const nsIDM = Ci.nsIDownloadManager;
const nsIWBP = Ci.nsIWebBrowserPersist;
const nsIWPL = Ci.nsIWebProgressListener;
const dm = Cc["@mozilla.org/download-manager;1"].getService(nsIDM);
dm.cleanUp();
if (!oldDownloadManagerDisabled()) {
dm.cleanUp();
}
function notify(aTopic)
{
@ -29,6 +31,10 @@ function notify(aTopic)
function run_test()
{
if (oldDownloadManagerDisabled()) {
return;
}
/**
* 0. Speed up the resume on wake delay from 10 seconds
*/