|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
4 */ |
|
5 |
|
6 /* General Complete MAR File Patch Apply Test */ |
|
7 |
|
8 function run_test() { |
|
9 setupTestCommon(); |
|
10 gTestFiles = gTestFilesCompleteSuccess; |
|
11 gTestDirs = gTestDirsCompleteSuccess; |
|
12 setupUpdaterTest(FILE_COMPLETE_MAR, false, false); |
|
13 |
|
14 // For Mac OS X set the last modified time for the root directory to a date in |
|
15 // the past to test that the last modified time is updated on a successful |
|
16 // update (bug 600098). |
|
17 if (IS_MACOSX) { |
|
18 let now = Date.now(); |
|
19 let yesterday = now - (1000 * 60 * 60 * 24); |
|
20 let applyToDir = getApplyDirFile(); |
|
21 applyToDir.lastModifiedTime = yesterday; |
|
22 } |
|
23 |
|
24 runUpdate(0, STATE_SUCCEEDED); |
|
25 } |
|
26 |
|
27 function checkUpdateApplied() { |
|
28 if (IS_MACOSX) { |
|
29 logTestInfo("testing last modified time on the apply to directory has " + |
|
30 "changed after a successful update (bug 600098)"); |
|
31 let now = Date.now(); |
|
32 let applyToDir = getApplyDirFile(); |
|
33 let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); |
|
34 do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); |
|
35 } |
|
36 |
|
37 checkFilesAfterUpdateSuccess(); |
|
38 // Sorting on Linux is different so skip this check for now. |
|
39 if (!IS_UNIX) { |
|
40 checkUpdateLogContents(LOG_COMPLETE_SUCCESS); |
|
41 } |
|
42 |
|
43 checkCallbackAppLog(); |
|
44 } |