1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForDifferentChannel.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,44 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + */ 1.8 + 1.9 +/* General Update Manager Tests */ 1.10 + 1.11 +function run_test() { 1.12 + setupTestCommon(); 1.13 + 1.14 + logTestInfo("testing removal of an active update for a channel that is not" + 1.15 + "valid due to switching channels (Bug 486275)."); 1.16 + 1.17 + var patches, updates, update; 1.18 + patches = getLocalPatchString(null, null, null, null, null, null, 1.19 + STATE_DOWNLOADING); 1.20 + updates = getLocalUpdateString(patches, null, null, "version 1.0", "1.0"); 1.21 + writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true); 1.22 + writeStatusFile(STATE_DOWNLOADING); 1.23 + 1.24 + patches = getLocalPatchString(null, null, null, null, null, null, 1.25 + STATE_FAILED); 1.26 + updates = getLocalUpdateString(patches, null, "Existing", "version 3.0", 1.27 + "3.0", "3.0", null, null, null, null, null, 1.28 + getString("patchApplyFailure")); 1.29 + writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), false); 1.30 + 1.31 + setUpdateChannel("original_channel"); 1.32 + 1.33 + standardInit(); 1.34 + 1.35 + do_check_eq(gUpdateManager.updateCount, 1); 1.36 + update = gUpdateManager.getUpdateAt(0); 1.37 + do_check_eq(update.name, "Existing"); 1.38 + 1.39 + do_check_eq(gUpdateManager.activeUpdate, null); 1.40 + // Verify that the active-update.xml file has had the update from the old 1.41 + // channel removed. 1.42 + file = getUpdatesXMLFile(true); 1.43 + logTestInfo("verifying contents of " + FILE_UPDATE_ACTIVE); 1.44 + do_check_eq(readFile(file), getLocalUpdatesXMLString("")); 1.45 + 1.46 + doTestFinish(); 1.47 +}