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