Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 Test */
8 function run_test() {
9 setupTestCommon();
10 gTestFiles = gTestFilesPartialSuccess;
11 gTestFiles[gTestFiles.length - 1].originalContents = null;
12 gTestFiles[gTestFiles.length - 1].compareContents = "FromPartial\n";
13 gTestFiles[gTestFiles.length - 1].comparePerms = 0o644;
14 gTestFiles[gTestFiles.length - 2].originalContents = null;
15 gTestFiles[gTestFiles.length - 2].compareContents = "FromPartial\n";
16 gTestFiles[gTestFiles.length - 2].comparePerms = 0o644;
17 gTestDirs = gTestDirsPartialSuccess;
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 runUpdate(0, STATE_SUCCEEDED);
31 }
33 function checkUpdateApplied() {
34 if (IS_MACOSX) {
35 logTestInfo("testing last modified time on the apply to directory has " +
36 "changed after a successful update (bug 600098)");
37 let now = Date.now();
38 let applyToDir = getApplyDirFile();
39 let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
40 do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
41 }
43 checkFilesAfterUpdateSuccess();
44 // Sorting on Linux is different so skip this check for now.
45 if (!IS_UNIX) {
46 checkUpdateLogContents(LOG_PARTIAL_SUCCESS);
47 }
49 checkCallbackAppLog();
50 }