michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ michael@0: */ michael@0: michael@0: /* Application in use complete MAR file patch apply success test */ michael@0: michael@0: function run_test() { michael@0: setupTestCommon(); michael@0: gTestFiles = gTestFilesCompleteSuccess; michael@0: gTestDirs = gTestDirsCompleteSuccess; michael@0: setupUpdaterTest(FILE_COMPLETE_MAR, false, false); michael@0: michael@0: // Launch the callback helper application so it is in use during the update. michael@0: let callbackApp = getApplyDirFile("a/b/" + gCallbackBinFile); michael@0: callbackApp.permissions = PERMS_DIRECTORY; michael@0: let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", michael@0: HELPER_SLEEP_TIMEOUT]; michael@0: let callbackAppProcess = AUS_Cc["@mozilla.org/process/util;1"]. michael@0: createInstance(AUS_Ci.nsIProcess); michael@0: callbackAppProcess.init(callbackApp); michael@0: callbackAppProcess.run(false, args, args.length); michael@0: michael@0: do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep); michael@0: } michael@0: michael@0: function doUpdate() { michael@0: // For Mac OS X set the last modified time for the root directory to a date in michael@0: // the past to test that the last modified time is updated on a successful michael@0: // update (bug 600098). michael@0: if (IS_MACOSX) { michael@0: let applyToDir = getApplyDirFile(); michael@0: let now = Date.now(); michael@0: let yesterday = now - (1000 * 60 * 60 * 24); michael@0: applyToDir.lastModifiedTime = yesterday; michael@0: } michael@0: michael@0: runUpdate(0, STATE_SUCCEEDED); michael@0: } michael@0: michael@0: function checkUpdateApplied() { michael@0: setupHelperFinish(); michael@0: } michael@0: michael@0: function checkUpdate() { michael@0: if (IS_MACOSX) { michael@0: logTestInfo("testing last modified time on the apply to directory has " + michael@0: "changed after a successful update (bug 600098)"); michael@0: let now = Date.now(); michael@0: let applyToDir = getApplyDirFile(); michael@0: let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); michael@0: do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); michael@0: } michael@0: michael@0: checkFilesAfterUpdateSuccess(); michael@0: // Sorting on Linux is different so skip this check for now. michael@0: if (!IS_UNIX) { michael@0: checkUpdateLogContents(LOG_COMPLETE_SUCCESS); michael@0: } michael@0: michael@0: checkCallbackAppLog(); michael@0: }