toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessComplete_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 in use inside removed dir complete MAR file patch apply success test */
     7 function run_test() {
     8   setupTestCommon();
     9   gTestFiles = gTestFilesCompleteSuccess;
    10   gTestDirs = gTestDirsCompleteSuccess;
    11   setupUpdaterTest(FILE_COMPLETE_MAR, false, true);
    13   let fileInUseBin = getApplyDirFile(gTestDirs[4].relPathDir +
    14                                      gTestDirs[4].subDirs[0] +
    15                                      gTestDirs[4].subDirFiles[0]);
    16   // Remove the empty file created for the test so the helper application can
    17   // replace it.
    18   fileInUseBin.remove(false);
    20   let helperBin = getTestDirFile(FILE_HELPER_BIN);
    21   let fileInUseDir = getApplyDirFile(gTestDirs[4].relPathDir +
    22                                      gTestDirs[4].subDirs[0]);
    23   helperBin.copyTo(fileInUseDir, gTestDirs[4].subDirFiles[0]);
    25   // Launch an existing file so it is in use during the update.
    26   let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
    27               HELPER_SLEEP_TIMEOUT];
    28   let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
    29                          createInstance(AUS_Ci.nsIProcess);
    30   fileInUseProcess.init(fileInUseBin);
    31   fileInUseProcess.run(false, args, args.length);
    33   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
    34 }
    36 function doUpdate() {
    37   runUpdate(0, STATE_SUCCEEDED);
    38 }
    40 function checkUpdateApplied() {
    41   setupHelperFinish();
    42 }
    44 function checkUpdate() {
    45   checkFilesAfterUpdateSuccess();
    46   checkUpdateLogContains(ERR_BACKUP_DISCARD);
    47   checkCallbackAppLog();
    48 }

mercurial