toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForDifferentChannel.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 Update Manager Tests */
     8 function run_test() {
     9   setupTestCommon();
    11   logTestInfo("testing removal of an active update for a channel that is not" +
    12               "valid due to switching channels (Bug 486275).");
    14   var patches, updates, update;
    15   patches = getLocalPatchString(null, null, null, null, null, null,
    16                                 STATE_DOWNLOADING);
    17   updates = getLocalUpdateString(patches, null, null, "version 1.0", "1.0");
    18   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
    19   writeStatusFile(STATE_DOWNLOADING);
    21   patches = getLocalPatchString(null, null, null, null, null, null,
    22                                 STATE_FAILED);
    23   updates = getLocalUpdateString(patches, null, "Existing", "version 3.0",
    24                                  "3.0", "3.0", null, null, null, null, null,
    25                                  getString("patchApplyFailure"));
    26   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), false);
    28   setUpdateChannel("original_channel");
    30   standardInit();
    32   do_check_eq(gUpdateManager.updateCount, 1);
    33   update = gUpdateManager.getUpdateAt(0);
    34   do_check_eq(update.name, "Existing");
    36   do_check_eq(gUpdateManager.activeUpdate, null);
    37   // Verify that the active-update.xml file has had the update from the old
    38   // channel removed.
    39   file = getUpdatesXMLFile(true);
    40   logTestInfo("verifying contents of " + FILE_UPDATE_ACTIVE);
    41   do_check_eq(readFile(file), getLocalUpdatesXMLString(""));
    43   doTestFinish();
    44 }

mercurial