Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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 */
6 /* General Partial MAR File Patch Apply Failure Test */
8 function run_test() {
9 if (!shouldRunServiceTest()) {
10 return;
11 }
13 setupTestCommon();
14 gTestFiles = gTestFilesPartialSuccess;
15 gTestFiles[11].originalFile = "partial.png";
16 gTestDirs = gTestDirsPartialSuccess;
17 setTestFilesAndDirsForFailure();
18 setupUpdaterTest(FILE_PARTIAL_MAR, false, false);
20 // For Mac OS X set the last modified time for the root directory to a date in
21 // the past to test that the last modified time is updated on all updates since
22 // the precomplete file in the root of the bundle is renamed, etc. (bug 600098).
23 if (IS_MACOSX) {
24 let now = Date.now();
25 let yesterday = now - (1000 * 60 * 60 * 24);
26 let applyToDir = getApplyDirFile();
27 applyToDir.lastModifiedTime = yesterday;
28 }
30 setupAppFilesAsync();
31 }
33 function setupAppFilesFinished() {
34 runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED);
35 }
37 function checkUpdateFinished() {
38 if (IS_MACOSX) {
39 logTestInfo("testing last modified time on the apply to directory has " +
40 "changed after a successful update (bug 600098)");
41 let now = Date.now();
42 let applyToDir = getApplyDirFile();
43 let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
44 do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
45 }
47 checkFilesAfterUpdateFailure();
48 // Sorting on Linux is different so skip this check for now.
49 if (!IS_UNIX) {
50 checkUpdateLogContents(LOG_PARTIAL_FAILURE);
51 }
53 checkCallbackServiceLog();
54 }