toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailurePartial_win.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:b997fa3f5ca8
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/
3 */
4
5 /* File locked partial MAR file patch apply failure test */
6
7 function run_test() {
8 setupTestCommon();
9 gTestFiles = gTestFilesPartialSuccess;
10 gTestDirs = gTestDirsPartialSuccess;
11 setTestFilesAndDirsForFailure();
12 setupUpdaterTest(FILE_PARTIAL_MAR, false, false);
13
14 // Exclusively lock an existing file so it is in use during the update.
15 let helperBin = getTestDirFile(FILE_HELPER_BIN);
16 let helperDestDir = getApplyDirFile("a/b/");
17 helperBin.copyTo(helperDestDir, FILE_HELPER_BIN);
18 helperBin = getApplyDirFile("a/b/" + FILE_HELPER_BIN);
19 // Strip off the first two directories so the path has to be from the helper's
20 // working directory.
21 let lockFileRelPath = gTestFiles[2].relPathDir.split("/");
22 lockFileRelPath = lockFileRelPath.slice(2);
23 lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[2].fileName;
24 let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
25 HELPER_SLEEP_TIMEOUT, lockFileRelPath];
26 let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
27 createInstance(AUS_Ci.nsIProcess);
28 lockFileProcess.init(helperBin);
29 lockFileProcess.run(false, args, args.length);
30
31 do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
32 }
33
34 function doUpdate() {
35 runUpdate(1, STATE_FAILED_READ_ERROR);
36 }
37
38 function checkUpdateApplied() {
39 setupHelperFinish();
40 }
41
42 function checkUpdate() {
43 checkFilesAfterUpdateFailure();
44 checkUpdateLogContains(ERR_UNABLE_OPEN_DEST);
45 checkCallbackAppLog();
46 }

mercurial