diff -r 000000000000 -r 6474c204b198 toolkit/mozapps/update/tests/unit_base_updater/marSuccessComplete.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolkit/mozapps/update/tests/unit_base_updater/marSuccessComplete.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,44 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/* General Complete MAR File Patch Apply Test */ + +function run_test() { + setupTestCommon(); + gTestFiles = gTestFilesCompleteSuccess; + gTestDirs = gTestDirsCompleteSuccess; + setupUpdaterTest(FILE_COMPLETE_MAR, false, false); + + // For Mac OS X set the last modified time for the root directory to a date in + // the past to test that the last modified time is updated on a successful + // update (bug 600098). + if (IS_MACOSX) { + let now = Date.now(); + let yesterday = now - (1000 * 60 * 60 * 24); + let applyToDir = getApplyDirFile(); + applyToDir.lastModifiedTime = yesterday; + } + + runUpdate(0, STATE_SUCCEEDED); +} + +function checkUpdateApplied() { + if (IS_MACOSX) { + logTestInfo("testing last modified time on the apply to directory has " + + "changed after a successful update (bug 600098)"); + let now = Date.now(); + let applyToDir = getApplyDirFile(); + let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); + do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); + } + + checkFilesAfterUpdateSuccess(); + // Sorting on Linux is different so skip this check for now. + if (!IS_UNIX) { + checkUpdateLogContents(LOG_COMPLETE_SUCCESS); + } + + checkCallbackAppLog(); +}