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.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 4 */
michael@0 5
michael@0 6 function run_test() {
michael@0 7 setupTestCommon();
michael@0 8
michael@0 9 logTestInfo("testing resuming an update download in progress for the same " +
michael@0 10 "version of the application on startup (Bug 485624)");
michael@0 11
michael@0 12 var patches, updates;
michael@0 13
michael@0 14 patches = getLocalPatchString(null, null, null, null, null, null,
michael@0 15 STATE_DOWNLOADING);
michael@0 16 updates = getLocalUpdateString(patches, null, null, "1.0", "1.0");
michael@0 17 writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
michael@0 18 writeStatusFile(STATE_DOWNLOADING);
michael@0 19
michael@0 20 writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
michael@0 21
michael@0 22 standardInit();
michael@0 23
michael@0 24 if (IS_TOOLKIT_GONK) {
michael@0 25 // GONK doesn't resume downloads at boot time, so the updateCount will
michael@0 26 // always be zero.
michael@0 27 do_check_eq(gUpdateManager.updateCount, 0);
michael@0 28 } else {
michael@0 29 do_check_eq(gUpdateManager.updateCount, 1);
michael@0 30 }
michael@0 31 do_check_eq(gUpdateManager.activeUpdate.state, STATE_DOWNLOADING);
michael@0 32
michael@0 33 // Pause the download and reload the Update Manager with an empty update so
michael@0 34 // the Application Update Service doesn't write the update xml files during
michael@0 35 // xpcom-shutdown which will leave behind the test directory.
michael@0 36 gAUS.pauseDownload();
michael@0 37 writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), true);
michael@0 38 writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
michael@0 39 reloadUpdateManagerData();
michael@0 40
michael@0 41 do_timeout(TEST_CHECK_TIMEOUT, doTestFinish);
michael@0 42 }

mercurial