1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/update/tests/unit_base_updater/marSuccessPartial.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,50 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + */ 1.8 + 1.9 +/* General Partial MAR File Patch Apply Test */ 1.10 + 1.11 +function run_test() { 1.12 + setupTestCommon(); 1.13 + gTestFiles = gTestFilesPartialSuccess; 1.14 + gTestFiles[gTestFiles.length - 1].originalContents = null; 1.15 + gTestFiles[gTestFiles.length - 1].compareContents = "FromPartial\n"; 1.16 + gTestFiles[gTestFiles.length - 1].comparePerms = 0o644; 1.17 + gTestFiles[gTestFiles.length - 2].originalContents = null; 1.18 + gTestFiles[gTestFiles.length - 2].compareContents = "FromPartial\n"; 1.19 + gTestFiles[gTestFiles.length - 2].comparePerms = 0o644; 1.20 + gTestDirs = gTestDirsPartialSuccess; 1.21 + setupUpdaterTest(FILE_PARTIAL_MAR, false, false); 1.22 + 1.23 + // For Mac OS X set the last modified time for the root directory to a date in 1.24 + // the past to test that the last modified time is updated on all updates since 1.25 + // the precomplete file in the root of the bundle is renamed, etc. (bug 600098). 1.26 + if (IS_MACOSX) { 1.27 + let now = Date.now(); 1.28 + let yesterday = now - (1000 * 60 * 60 * 24); 1.29 + let applyToDir = getApplyDirFile(); 1.30 + applyToDir.lastModifiedTime = yesterday; 1.31 + } 1.32 + 1.33 + runUpdate(0, STATE_SUCCEEDED); 1.34 +} 1.35 + 1.36 +function checkUpdateApplied() { 1.37 + if (IS_MACOSX) { 1.38 + logTestInfo("testing last modified time on the apply to directory has " + 1.39 + "changed after a successful update (bug 600098)"); 1.40 + let now = Date.now(); 1.41 + let applyToDir = getApplyDirFile(); 1.42 + let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); 1.43 + do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); 1.44 + } 1.45 + 1.46 + checkFilesAfterUpdateSuccess(); 1.47 + // Sorting on Linux is different so skip this check for now. 1.48 + if (!IS_UNIX) { 1.49 + checkUpdateLogContents(LOG_PARTIAL_SUCCESS); 1.50 + } 1.51 + 1.52 + checkCallbackAppLog(); 1.53 +}