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: function run_test() { michael@0: setupTestCommon(); michael@0: michael@0: logTestInfo("testing resuming an update download in progress for the same " + michael@0: "version of the application on startup (Bug 485624)"); michael@0: michael@0: var patches, updates; michael@0: michael@0: patches = getLocalPatchString(null, null, null, null, null, null, michael@0: STATE_DOWNLOADING); michael@0: updates = getLocalUpdateString(patches, null, null, "1.0", "1.0"); michael@0: writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true); michael@0: writeStatusFile(STATE_DOWNLOADING); michael@0: michael@0: writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false); michael@0: michael@0: standardInit(); michael@0: michael@0: if (IS_TOOLKIT_GONK) { michael@0: // GONK doesn't resume downloads at boot time, so the updateCount will michael@0: // always be zero. michael@0: do_check_eq(gUpdateManager.updateCount, 0); michael@0: } else { michael@0: do_check_eq(gUpdateManager.updateCount, 1); michael@0: } michael@0: do_check_eq(gUpdateManager.activeUpdate.state, STATE_DOWNLOADING); michael@0: michael@0: // Pause the download and reload the Update Manager with an empty update so michael@0: // the Application Update Service doesn't write the update xml files during michael@0: // xpcom-shutdown which will leave behind the test directory. michael@0: gAUS.pauseDownload(); michael@0: writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), true); michael@0: writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false); michael@0: reloadUpdateManagerData(); michael@0: michael@0: do_timeout(TEST_CHECK_TIMEOUT, doTestFinish); michael@0: }