diff -r 000000000000 -r 6474c204b198 toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessComplete_win.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessComplete_win.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,38 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/* File in use complete MAR file patch apply success test */ + +function run_test() { + setupTestCommon(); + gTestFiles = gTestFilesCompleteSuccess; + gTestDirs = gTestDirsCompleteSuccess; + setupUpdaterTest(FILE_COMPLETE_MAR, false, true); + + // Launch an existing file so it is in use during the update. + let fileInUseBin = getApplyDirFile(gTestFiles[13].relPathDir + + gTestFiles[13].fileName); + let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", + HELPER_SLEEP_TIMEOUT]; + let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"]. + createInstance(AUS_Ci.nsIProcess); + fileInUseProcess.init(fileInUseBin); + fileInUseProcess.run(false, args, args.length); + + do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep); +} + +function doUpdate() { + runUpdate(0, STATE_SUCCEEDED); +} + +function checkUpdateApplied() { + setupHelperFinish(); +} + +function checkUpdate() { + checkFilesAfterUpdateSuccess(); + checkUpdateLogContains(ERR_BACKUP_DISCARD); + checkCallbackAppLog(); +}