toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessCompleteSvc_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   if (!shouldRunServiceTest()) {
     9     return;
    10   }
    12   setupTestCommon();
    13   gTestFiles = gTestFilesCompleteSuccess;
    14   gTestDirs = gTestDirsCompleteSuccess;
    15   setupUpdaterTest(FILE_COMPLETE_MAR, false, true);
    17   let fileInUseBin = getApplyDirFile(gTestDirs[4].relPathDir +
    18                                      gTestDirs[4].subDirs[0] +
    19                                      gTestDirs[4].subDirFiles[0]);
    20   // Remove the empty file created for the test so the helper application can
    21   // replace it.
    22   fileInUseBin.remove(false);
    24   let helperBin = getTestDirFile(FILE_HELPER_BIN);
    25   let fileInUseDir = getApplyDirFile(gTestDirs[4].relPathDir +
    26                                      gTestDirs[4].subDirs[0]);
    27   helperBin.copyTo(fileInUseDir, gTestDirs[4].subDirFiles[0]);
    29   // Launch an existing file so it is in use during the update.
    30   let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
    31               HELPER_SLEEP_TIMEOUT];
    32   let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
    33                          createInstance(AUS_Ci.nsIProcess);
    34   fileInUseProcess.init(fileInUseBin);
    35   fileInUseProcess.run(false, args, args.length);
    37   setupAppFilesAsync();
    38 }
    40 function setupAppFilesFinished() {
    41   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
    42 }
    44 function doUpdate() {
    45   runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
    46 }
    48 function checkUpdateFinished() {
    49   setupHelperFinish();
    50 }
    52 function checkUpdate() {
    53   checkFilesAfterUpdateSuccess();
    54   checkUpdateLogContains(ERR_BACKUP_DISCARD);
    55   checkCallbackServiceLog();
    56 }

mercurial