Make the download manager tests remove their temporary files, and rename the prefix they use to work around the Mac unit test machine having filled up all of dmuitest.file through dmuitest-9999.file in its temp dir. rs=sdwilsh a=tests+orange

This commit is contained in:
dbaron@dbaron.org 2008-03-21 20:57:47 -07:00
parent 4e8a61dfba
commit 0ba7646d32
7 changed files with 15 additions and 7 deletions

View File

@ -38,7 +38,7 @@
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var dmFile = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
dmFile.append("dmuitest.file");
dmFile.append("dm-ui-test.file");
dmFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
var gTestPath = ios.newFileURI(dmFile).spec;
@ -200,6 +200,7 @@ function test()
t(win);
win.close();
dmFile.remove(false);
finish();
}

View File

@ -38,7 +38,7 @@
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var dmFile = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
dmFile.append("dmuitest.file");
dmFile.append("dm-ui-test.file");
dmFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
var gTestPath = ios.newFileURI(dmFile).spec;
@ -120,6 +120,7 @@ function test()
t(win);
win.close();
dmFile.remove(false);
finish();
}

View File

@ -80,6 +80,7 @@ function test()
ok(aDownload.referrer.spec == referrer, "Got referrer on finish");
dm.removeListener(listener);
file.remove(false);
finish();
break;
}

View File

@ -38,7 +38,7 @@
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var dmFile = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
dmFile.append("dmuitest.file");
dmFile.append("dm-ui-test.file");
dmFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
var gTestPath = ios.newFileURI(dmFile).spec;
@ -142,6 +142,7 @@ function test()
t(win);
win.close();
dmFile.remove(false);
finish();
}

View File

@ -38,7 +38,7 @@
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var dmFile = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
dmFile.append("dmuitest.file");
dmFile.append("dm-ui-test.file");
dmFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
var gTestPath = ios.newFileURI(dmFile).spec;
@ -162,6 +162,7 @@ function test()
t(win);
win.close();
dmFile.remove(false);
finish();
}

View File

@ -38,7 +38,7 @@
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var dmFile = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
dmFile.append("dmuitest.file");
dmFile.append("dm-ui-test.file");
dmFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
var gTestPath = ios.newFileURI(dmFile).spec;
@ -162,6 +162,7 @@ function test()
t(win);
win.close();
dmFile.remove(false);
finish();
}

View File

@ -37,11 +37,13 @@
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
let didFail = false;
var file;
let promptService = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPromptService]),
alert: function() {
ok(didFail, "javascript: uri failed and showed a message");
file.remove(false);
finish();
}
};
@ -74,8 +76,8 @@ function test()
stmt.bindStringParameter(0, "javascript:5");
// Download to a temp local file
let file = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
file = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
file.append("javascriptURI");
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
stmt.bindStringParameter(1, Cc["@mozilla.org/network/io-service;1"].