toolkit/mozapps/update/tests/unit_aus_update/downloadResumeForSameAppVersion.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 /* 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 function run_test() {
     7   setupTestCommon();
     9   logTestInfo("testing resuming an update download in progress for the same " +
    10               "version of the application on startup (Bug 485624)");
    12   var patches, updates;
    14   patches = getLocalPatchString(null, null, null, null, null, null,
    15                                 STATE_DOWNLOADING);
    16   updates = getLocalUpdateString(patches, null, null, "1.0", "1.0");
    17   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
    18   writeStatusFile(STATE_DOWNLOADING);
    20   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
    22   standardInit();
    24   if (IS_TOOLKIT_GONK) {
    25     // GONK doesn't resume downloads at boot time, so the updateCount will
    26     // always be zero.
    27     do_check_eq(gUpdateManager.updateCount, 0);
    28   } else {
    29     do_check_eq(gUpdateManager.updateCount, 1);
    30   }
    31   do_check_eq(gUpdateManager.activeUpdate.state, STATE_DOWNLOADING);
    33   // Pause the download and reload the Update Manager with an empty update so
    34   // the Application Update Service doesn't write the update xml files during
    35   // xpcom-shutdown which will leave behind the test directory.
    36   gAUS.pauseDownload();
    37   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), true);
    38   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
    39   reloadUpdateManagerData();
    41   do_timeout(TEST_CHECK_TIMEOUT, doTestFinish);
    42 }

mercurial