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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/
     3  */
     5 /* File locked complete MAR file patch apply failure test */
     7 function run_test() {
     8   setupTestCommon();
     9   gTestFiles = gTestFilesCompleteSuccess;
    10   gTestDirs = gTestDirsCompleteSuccess;
    11   setTestFilesAndDirsForFailure();
    12   setupUpdaterTest(FILE_COMPLETE_MAR, false, false);
    14   // Exclusively lock an existing file so it is in use during the update.
    15   let helperBin = getTestDirFile(FILE_HELPER_BIN);
    16   let helperDestDir = getApplyDirFile("a/b/");
    17   helperBin.copyTo(helperDestDir, FILE_HELPER_BIN);
    18   helperBin = getApplyDirFile("a/b/" + FILE_HELPER_BIN);
    19   // Strip off the first two directories so the path has to be from the helper's
    20   // working directory.
    21   let lockFileRelPath = gTestFiles[3].relPathDir.split("/");
    22   lockFileRelPath = lockFileRelPath.slice(2);
    23   lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[3].fileName;
    24   let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
    25               HELPER_SLEEP_TIMEOUT, lockFileRelPath];
    26   let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
    27                      createInstance(AUS_Ci.nsIProcess);
    28   lockFileProcess.init(helperBin);
    29   lockFileProcess.run(false, args, args.length);
    31   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
    32 }
    34 function doUpdate() {
    35   runUpdate(1, STATE_FAILED_WRITE_ERROR);
    36 }
    38 function checkUpdateApplied() {
    39   setupHelperFinish();
    40 }
    42 function checkUpdate() {
    43   checkFilesAfterUpdateFailure();
    44   checkUpdateLogContains(ERR_RENAME_FILE);
    45   checkCallbackAppLog();
    46 }

mercurial