michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: */ michael@0: michael@0: /* General Update Manager Tests */ michael@0: michael@0: function run_test() { michael@0: setupTestCommon(); michael@0: michael@0: logTestInfo("testing removal of an active update for a channel that is not" + michael@0: "valid due to switching channels (Bug 486275)."); michael@0: michael@0: var patches, updates, update; michael@0: patches = getLocalPatchString(null, null, null, null, null, null, michael@0: STATE_DOWNLOADING); michael@0: updates = getLocalUpdateString(patches, null, null, "version 1.0", "1.0"); michael@0: writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true); michael@0: writeStatusFile(STATE_DOWNLOADING); michael@0: michael@0: patches = getLocalPatchString(null, null, null, null, null, null, michael@0: STATE_FAILED); michael@0: updates = getLocalUpdateString(patches, null, "Existing", "version 3.0", michael@0: "3.0", "3.0", null, null, null, null, null, michael@0: getString("patchApplyFailure")); michael@0: writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), false); michael@0: michael@0: setUpdateChannel("original_channel"); michael@0: michael@0: standardInit(); michael@0: michael@0: do_check_eq(gUpdateManager.updateCount, 1); michael@0: update = gUpdateManager.getUpdateAt(0); michael@0: do_check_eq(update.name, "Existing"); michael@0: michael@0: do_check_eq(gUpdateManager.activeUpdate, null); michael@0: // Verify that the active-update.xml file has had the update from the old michael@0: // channel removed. michael@0: file = getUpdatesXMLFile(true); michael@0: logTestInfo("verifying contents of " + FILE_UPDATE_ACTIVE); michael@0: do_check_eq(readFile(file), getLocalUpdatesXMLString("")); michael@0: michael@0: doTestFinish(); michael@0: }