toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForDifferentChannel.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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