2008-01-10 00:10:06 +03:00
|
|
|
var nameArray = [
|
|
|
|
"ascii", // ASCII
|
|
|
|
"fran\u00E7ais", // Latin-1
|
|
|
|
"\u0420\u0443\u0441\u0441\u043A\u0438\u0439", // Cyrillic
|
|
|
|
"\u65E5\u672C\u8A9E", // Japanese
|
|
|
|
"\u4E2D\u6587", // Chinese
|
|
|
|
"\uD55C\uAD6D\uC5B4", // Korean
|
|
|
|
"\uD801\uDC0F\uD801\uDC2D\uD801\uDC3B\uD801\uDC2B", // Deseret
|
|
|
|
];
|
|
|
|
|
2017-09-29 01:49:04 +03:00
|
|
|
function getTempDir() {
|
2017-08-04 11:49:22 +03:00
|
|
|
return Services.dirsvc.get("TmpD", Ci.nsIFile);
|
2008-01-10 00:10:06 +03:00
|
|
|
}
|
|
|
|
|
2017-09-29 01:49:04 +03:00
|
|
|
function create_file(fileName) {
|
2008-01-10 00:10:06 +03:00
|
|
|
var outFile = getTempDir();
|
|
|
|
outFile.append(fileName);
|
2016-02-15 10:57:00 +03:00
|
|
|
outFile.createUnique(outFile.NORMAL_FILE_TYPE, 0o600);
|
2008-01-10 00:10:06 +03:00
|
|
|
|
|
|
|
var stream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(
|
2017-09-29 02:12:52 +03:00
|
|
|
Ci.nsIFileOutputStream
|
|
|
|
);
|
2016-02-15 10:57:00 +03:00
|
|
|
stream.init(outFile, 0x02 | 0x08 | 0x20, 0o600, 0);
|
2008-01-10 00:10:06 +03:00
|
|
|
stream.write("foo", 3);
|
|
|
|
stream.close();
|
|
|
|
|
|
|
|
Assert.equal(outFile.leafName.substr(0, fileName.length), fileName);
|
|
|
|
|
|
|
|
return outFile;
|
|
|
|
}
|
|
|
|
|
2017-09-29 01:49:04 +03:00
|
|
|
function test_create(fileName) {
|
2008-01-10 00:10:06 +03:00
|
|
|
var file1 = create_file(fileName);
|
|
|
|
var file2 = create_file(fileName);
|
|
|
|
file1.remove(false);
|
|
|
|
file2.remove(false);
|
|
|
|
}
|
|
|
|
|
2017-09-29 01:49:04 +03:00
|
|
|
function run_test() {
|
2008-01-10 00:10:06 +03:00
|
|
|
for (var i = 0; i < nameArray.length; ++i) {
|
2017-09-29 02:12:52 +03:00
|
|
|
test_create(nameArray[i]);
|
2008-01-10 00:10:06 +03:00
|
|
|
}
|
|
|
|
}
|