Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 | /* General Update Manager Tests */ |
michael@0 | 7 | |
michael@0 | 8 | function run_test() { |
michael@0 | 9 | setupTestCommon(); |
michael@0 | 10 | |
michael@0 | 11 | logTestInfo("testing removal of an active update for a channel that is not" + |
michael@0 | 12 | "valid due to switching channels (Bug 486275)."); |
michael@0 | 13 | |
michael@0 | 14 | var patches, updates, update; |
michael@0 | 15 | patches = getLocalPatchString(null, null, null, null, null, null, |
michael@0 | 16 | STATE_DOWNLOADING); |
michael@0 | 17 | updates = getLocalUpdateString(patches, null, null, "version 1.0", "1.0"); |
michael@0 | 18 | writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true); |
michael@0 | 19 | writeStatusFile(STATE_DOWNLOADING); |
michael@0 | 20 | |
michael@0 | 21 | patches = getLocalPatchString(null, null, null, null, null, null, |
michael@0 | 22 | STATE_FAILED); |
michael@0 | 23 | updates = getLocalUpdateString(patches, null, "Existing", "version 3.0", |
michael@0 | 24 | "3.0", "3.0", null, null, null, null, null, |
michael@0 | 25 | getString("patchApplyFailure")); |
michael@0 | 26 | writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), false); |
michael@0 | 27 | |
michael@0 | 28 | setUpdateChannel("original_channel"); |
michael@0 | 29 | |
michael@0 | 30 | standardInit(); |
michael@0 | 31 | |
michael@0 | 32 | do_check_eq(gUpdateManager.updateCount, 1); |
michael@0 | 33 | update = gUpdateManager.getUpdateAt(0); |
michael@0 | 34 | do_check_eq(update.name, "Existing"); |
michael@0 | 35 | |
michael@0 | 36 | do_check_eq(gUpdateManager.activeUpdate, null); |
michael@0 | 37 | // Verify that the active-update.xml file has had the update from the old |
michael@0 | 38 | // channel removed. |
michael@0 | 39 | file = getUpdatesXMLFile(true); |
michael@0 | 40 | logTestInfo("verifying contents of " + FILE_UPDATE_ACTIVE); |
michael@0 | 41 | do_check_eq(readFile(file), getLocalUpdatesXMLString("")); |
michael@0 | 42 | |
michael@0 | 43 | doTestFinish(); |
michael@0 | 44 | } |