toolkit/mozapps/update/tests/unit_service_updater/marSuccessCompleteSvc.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 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     4  */
     6 /* General Complete MAR File Patch Apply Test */
     8 function run_test() {
     9   if (!shouldRunServiceTest()) {
    10     return;
    11   }
    13   setupTestCommon();
    14   gTestFiles = gTestFilesCompleteSuccess;
    15   gTestDirs = gTestDirsCompleteSuccess;
    16   setupUpdaterTest(FILE_COMPLETE_MAR, false, false);
    18   // For Mac OS X set the last modified time for the root directory to a date in
    19   // the past to test that the last modified time is updated on a successful
    20   // update (bug 600098).
    21   if (IS_MACOSX) {
    22     let now = Date.now();
    23     let yesterday = now - (1000 * 60 * 60 * 24);
    24     let applyToDir = getApplyDirFile();
    25     applyToDir.lastModifiedTime = yesterday;
    26   }
    28   setupAppFilesAsync();
    29 }
    31 function setupAppFilesFinished() {
    32   runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
    33 }
    35 function checkUpdateFinished() {
    36   if (IS_MACOSX) {
    37     logTestInfo("testing last modified time on the apply to directory has " +
    38                 "changed after a successful update (bug 600098)");
    39     let now = Date.now();
    40     let applyToDir = getApplyDirFile();
    41     let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
    42     do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
    43   }
    45   checkFilesAfterUpdateSuccess();
    46   // Sorting on Linux is different so skip this check for now.
    47   if (!IS_UNIX) {
    48     checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
    49   }
    51   checkCallbackServiceLog();
    52 }

mercurial