|
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 */ |
|
5 |
|
6 /* General Update Manager Tests */ |
|
7 |
|
8 function run_test() { |
|
9 setupTestCommon(); |
|
10 |
|
11 logTestInfo("testing removal of an active update for a channel that is not" + |
|
12 "valid due to switching channels (Bug 486275)."); |
|
13 |
|
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); |
|
20 |
|
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); |
|
27 |
|
28 setUpdateChannel("original_channel"); |
|
29 |
|
30 standardInit(); |
|
31 |
|
32 do_check_eq(gUpdateManager.updateCount, 1); |
|
33 update = gUpdateManager.getUpdateAt(0); |
|
34 do_check_eq(update.name, "Existing"); |
|
35 |
|
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("")); |
|
42 |
|
43 doTestFinish(); |
|
44 } |