|
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 function run_test() { |
|
7 setupTestCommon(); |
|
8 |
|
9 logTestInfo("testing resuming an update download in progress for the same " + |
|
10 "version of the application on startup (Bug 485624)"); |
|
11 |
|
12 var patches, updates; |
|
13 |
|
14 patches = getLocalPatchString(null, null, null, null, null, null, |
|
15 STATE_DOWNLOADING); |
|
16 updates = getLocalUpdateString(patches, null, null, "1.0", "1.0"); |
|
17 writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true); |
|
18 writeStatusFile(STATE_DOWNLOADING); |
|
19 |
|
20 writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false); |
|
21 |
|
22 standardInit(); |
|
23 |
|
24 if (IS_TOOLKIT_GONK) { |
|
25 // GONK doesn't resume downloads at boot time, so the updateCount will |
|
26 // always be zero. |
|
27 do_check_eq(gUpdateManager.updateCount, 0); |
|
28 } else { |
|
29 do_check_eq(gUpdateManager.updateCount, 1); |
|
30 } |
|
31 do_check_eq(gUpdateManager.activeUpdate.state, STATE_DOWNLOADING); |
|
32 |
|
33 // Pause the download and reload the Update Manager with an empty update so |
|
34 // the Application Update Service doesn't write the update xml files during |
|
35 // xpcom-shutdown which will leave behind the test directory. |
|
36 gAUS.pauseDownload(); |
|
37 writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), true); |
|
38 writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false); |
|
39 reloadUpdateManagerData(); |
|
40 |
|
41 do_timeout(TEST_CHECK_TIMEOUT, doTestFinish); |
|
42 } |