Bug 1180901 - Test that a locked file cannot be removed from the extensions trash directory on Windows r=mossop

--HG--
extra : amend_source : 2ec19a524037838b7ac9d4d5cb1c053f0728f891
This commit is contained in:
Trevor Rowbotham 2015-08-20 13:46:29 -07:00
Родитель ab37f7b1f2
Коммит 4076f4a2c1
3 изменённых файлов: 38 добавлений и 0 удалений

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

@ -0,0 +1,35 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
startupManager();
run_next_test();
}
add_task(function* () {
let profileDir = OS.Constants.Path.profileDir;
let trashDir = OS.Path.join(profileDir, "extensions", "trash");
let testFile = OS.Path.join(trashDir, "test.txt");
yield OS.File.makeDir(trashDir, {
from: profileDir,
ignoreExisting: true
});
let trashDirExists = yield OS.File.exists(trashDir);
ok(trashDirExists, "trash directory should have been created");
let file = yield OS.File.open(testFile, {create: true}, {winShare: 0});
let fileExists = yield OS.File.exists(testFile);
ok(fileExists, "test.txt should have been created in " + trashDir);
yield promiseInstallAllFiles([do_get_addon("test_install1")]);
yield promiseRestartManager();
fileExists = yield OS.File.exists(testFile);
ok(fileExists, "test.txt still exists");
yield file.close();
yield OS.File.removeDir(OS.Path.join(OS.Constants.Path.profileDir, "extensions"));
yield promiseShutdownManager();
});

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

@ -288,3 +288,5 @@ run-sequentially = Uses global XCurProcD dir.
[test_sourceURI.js]
[test_webextension.js]
[test_bootstrap_globals.js]
[test_bug1180901.js]
skip-if = os != "win"

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

@ -28,4 +28,5 @@ skip-if = appname != "firefox"
[test_XPIStates.js]
[include:xpcshell-shared.ini]