|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ |
|
3 */ |
|
4 |
|
5 /* File in use inside removed dir partial MAR file patch apply success test */ |
|
6 |
|
7 function run_test() { |
|
8 setupTestCommon(); |
|
9 gTestFiles = gTestFilesPartialSuccess; |
|
10 gTestDirs = gTestDirsPartialSuccess; |
|
11 setupUpdaterTest(FILE_PARTIAL_MAR, false, true); |
|
12 |
|
13 let fileInUseBin = getApplyDirFile(gTestDirs[2].relPathDir + |
|
14 gTestDirs[2].files[0]); |
|
15 // Remove the empty file created for the test so the helper application can |
|
16 // replace it. |
|
17 fileInUseBin.remove(false); |
|
18 |
|
19 let helperBin = getTestDirFile(FILE_HELPER_BIN); |
|
20 let fileInUseDir = getApplyDirFile(gTestDirs[2].relPathDir); |
|
21 helperBin.copyTo(fileInUseDir, gTestDirs[2].files[0]); |
|
22 |
|
23 // Launch an existing file so it is in use during the update. |
|
24 let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", |
|
25 HELPER_SLEEP_TIMEOUT]; |
|
26 let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"]. |
|
27 createInstance(AUS_Ci.nsIProcess); |
|
28 fileInUseProcess.init(fileInUseBin); |
|
29 fileInUseProcess.run(false, args, args.length); |
|
30 |
|
31 do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep); |
|
32 } |
|
33 |
|
34 function doUpdate() { |
|
35 runUpdate(0, STATE_SUCCEEDED); |
|
36 } |
|
37 |
|
38 function checkUpdateApplied() { |
|
39 setupHelperFinish(); |
|
40 } |
|
41 |
|
42 function checkUpdate() { |
|
43 checkFilesAfterUpdateSuccess(); |
|
44 checkUpdateLogContains(ERR_BACKUP_DISCARD); |
|
45 checkCallbackAppLog(); |
|
46 } |