toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessComplete_win.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessComplete_win.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,38 @@
     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 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 +  // Launch an existing file so it is in use during the update.
    1.17 +  let fileInUseBin = getApplyDirFile(gTestFiles[13].relPathDir +
    1.18 +                                     gTestFiles[13].fileName);
    1.19 +  let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
    1.20 +              HELPER_SLEEP_TIMEOUT];
    1.21 +  let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
    1.22 +                         createInstance(AUS_Ci.nsIProcess);
    1.23 +  fileInUseProcess.init(fileInUseBin);
    1.24 +  fileInUseProcess.run(false, args, args.length);
    1.25 +
    1.26 +  do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
    1.27 +}
    1.28 +
    1.29 +function doUpdate() {
    1.30 +  runUpdate(0, STATE_SUCCEEDED);
    1.31 +}
    1.32 +
    1.33 +function checkUpdateApplied() {
    1.34 +  setupHelperFinish();
    1.35 +}
    1.36 +
    1.37 +function checkUpdate() {
    1.38 +  checkFilesAfterUpdateSuccess();
    1.39 +  checkUpdateLogContains(ERR_BACKUP_DISCARD);
    1.40 +  checkCallbackAppLog();
    1.41 +}

mercurial