1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/update/tests/unit_base_updater/marSuccessComplete.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,44 @@ 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 Complete MAR File Patch Apply Test */ 1.10 + 1.11 +function run_test() { 1.12 + setupTestCommon(); 1.13 + gTestFiles = gTestFilesCompleteSuccess; 1.14 + gTestDirs = gTestDirsCompleteSuccess; 1.15 + setupUpdaterTest(FILE_COMPLETE_MAR, false, false); 1.16 + 1.17 + // For Mac OS X set the last modified time for the root directory to a date in 1.18 + // the past to test that the last modified time is updated on a successful 1.19 + // update (bug 600098). 1.20 + if (IS_MACOSX) { 1.21 + let now = Date.now(); 1.22 + let yesterday = now - (1000 * 60 * 60 * 24); 1.23 + let applyToDir = getApplyDirFile(); 1.24 + applyToDir.lastModifiedTime = yesterday; 1.25 + } 1.26 + 1.27 + runUpdate(0, STATE_SUCCEEDED); 1.28 +} 1.29 + 1.30 +function checkUpdateApplied() { 1.31 + if (IS_MACOSX) { 1.32 + logTestInfo("testing last modified time on the apply to directory has " + 1.33 + "changed after a successful update (bug 600098)"); 1.34 + let now = Date.now(); 1.35 + let applyToDir = getApplyDirFile(); 1.36 + let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); 1.37 + do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); 1.38 + } 1.39 + 1.40 + checkFilesAfterUpdateSuccess(); 1.41 + // Sorting on Linux is different so skip this check for now. 1.42 + if (!IS_UNIX) { 1.43 + checkUpdateLogContents(LOG_COMPLETE_SUCCESS); 1.44 + } 1.45 + 1.46 + checkCallbackAppLog(); 1.47 +}