blob: 2524c489df1410e0004990a68e25d67bbb74eee2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/**
* The intent of this file is to test temp file handling when
* downloading multiple pop3 messages with quarantining turned on.
*
* Original author: David Bienvenu <dbienvenu@mozilla.com>
*/
/* import-globals-from ../../../test/resources/POP3pump.js */
load("../../../resources/POP3pump.js");
var testSubjects = [
"[Bug 397009] A filter will let me tag, but not untag",
"Hello, did you receive my bugmail?",
];
var gExpectedFiles;
function run_test() {
Services.prefs.setBoolPref("mailnews.downloadToTempFile", true);
gExpectedFiles = createExpectedTemporaryFiles(2);
// add 2 messages
gPOP3Pump.files = ["../../../data/bugmail1", "../../../data/draft1"];
gPOP3Pump.onDone = continueTest;
do_test_pending();
gPOP3Pump.run();
}
function continueTest() {
dump("temp file path = " + gExpectedFiles[0].path + "\n");
dump("temp file path = " + gExpectedFiles[1].path + "\n");
for (let expectedFile of gExpectedFiles) {
Assert.ok(!expectedFile.exists());
}
// get message headers for the inbox folder
var msgCount = 0;
for (let hdr of localAccountUtils.inboxFolder.msgDatabase.enumerateMessages()) {
Assert.equal(hdr.subject, testSubjects[msgCount++]);
}
Assert.equal(msgCount, 2);
gPOP3Pump = null;
do_test_finished();
}
function createExpectedTemporaryFiles(numFiles) {
function createTemporaryFile() {
let file = Services.dirsvc.get("TmpD", Ci.nsIFile);
file.append("newmsg");
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600);
return file;
}
let expectedFiles = [];
for (let i = 0; i < numFiles; i++) {
expectedFiles.push(createTemporaryFile());
}
for (let expectedFile of expectedFiles) {
expectedFile.remove(false);
}
return expectedFiles;
}
|