toolkit/mozapps/update/tests/unit_base_updater/marAppInUseSuccessComplete.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 /* Application in use 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, false);
    13   // Launch the callback helper application so it is in use during the update.
    14   let callbackApp = getApplyDirFile("a/b/" + gCallbackBinFile);
    15   callbackApp.permissions = PERMS_DIRECTORY;
    16   let args = [getApplyDirPath() + "a/b/", "input", "output", "-s",
    17               HELPER_SLEEP_TIMEOUT];
    18   let callbackAppProcess = AUS_Cc["@mozilla.org/process/util;1"].
    19                            createInstance(AUS_Ci.nsIProcess);
    20   callbackAppProcess.init(callbackApp);
    21   callbackAppProcess.run(false, args, args.length);
    23   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
    24 }
    26 function doUpdate() {
    27   // For Mac OS X set the last modified time for the root directory to a date in
    28   // the past to test that the last modified time is updated on a successful
    29   // update (bug 600098).
    30   if (IS_MACOSX) {
    31     let applyToDir = getApplyDirFile();
    32     let now = Date.now();
    33     let yesterday = now - (1000 * 60 * 60 * 24);
    34     applyToDir.lastModifiedTime = yesterday;
    35   }
    37   runUpdate(0, STATE_SUCCEEDED);
    38 }
    40 function checkUpdateApplied() {
    41   setupHelperFinish();
    42 }
    44 function checkUpdate() {
    45   if (IS_MACOSX) {
    46     logTestInfo("testing last modified time on the apply to directory has " +
    47                 "changed after a successful update (bug 600098)");
    48     let now = Date.now();
    49     let applyToDir = getApplyDirFile();
    50     let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
    51     do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
    52   }
    54   checkFilesAfterUpdateSuccess();
    55   // Sorting on Linux is different so skip this check for now.
    56   if (!IS_UNIX) {
    57     checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
    58   }
    60   checkCallbackAppLog();
    61 }

mercurial