1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessComplete_win.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,48 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ 1.6 + */ 1.7 + 1.8 +/* File in use inside removed dir complete MAR file patch apply success test */ 1.9 + 1.10 +function run_test() { 1.11 + setupTestCommon(); 1.12 + gTestFiles = gTestFilesCompleteSuccess; 1.13 + gTestDirs = gTestDirsCompleteSuccess; 1.14 + setupUpdaterTest(FILE_COMPLETE_MAR, false, true); 1.15 + 1.16 + let fileInUseBin = getApplyDirFile(gTestDirs[4].relPathDir + 1.17 + gTestDirs[4].subDirs[0] + 1.18 + gTestDirs[4].subDirFiles[0]); 1.19 + // Remove the empty file created for the test so the helper application can 1.20 + // replace it. 1.21 + fileInUseBin.remove(false); 1.22 + 1.23 + let helperBin = getTestDirFile(FILE_HELPER_BIN); 1.24 + let fileInUseDir = getApplyDirFile(gTestDirs[4].relPathDir + 1.25 + gTestDirs[4].subDirs[0]); 1.26 + helperBin.copyTo(fileInUseDir, gTestDirs[4].subDirFiles[0]); 1.27 + 1.28 + // Launch an existing file so it is in use during the update. 1.29 + let args = [getApplyDirPath() + "a/b/", "input", "output", "-s", 1.30 + HELPER_SLEEP_TIMEOUT]; 1.31 + let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"]. 1.32 + createInstance(AUS_Ci.nsIProcess); 1.33 + fileInUseProcess.init(fileInUseBin); 1.34 + fileInUseProcess.run(false, args, args.length); 1.35 + 1.36 + do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep); 1.37 +} 1.38 + 1.39 +function doUpdate() { 1.40 + runUpdate(0, STATE_SUCCEEDED); 1.41 +} 1.42 + 1.43 +function checkUpdateApplied() { 1.44 + setupHelperFinish(); 1.45 +} 1.46 + 1.47 +function checkUpdate() { 1.48 + checkFilesAfterUpdateSuccess(); 1.49 + checkUpdateLogContains(ERR_BACKUP_DISCARD); 1.50 + checkCallbackAppLog(); 1.51 +}