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

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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