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 update logs are first in first out deleted"); michael@0: michael@0: writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false); michael@0: var patches = getLocalPatchString(null, null, null, null, null, null, michael@0: STATE_PENDING); michael@0: var updates = getLocalUpdateString(patches); michael@0: writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true); michael@0: writeStatusFile(STATE_SUCCEEDED); michael@0: michael@0: var dir = getUpdatesDir(); michael@0: var log = dir.clone(); michael@0: log.append(FILE_LAST_LOG); michael@0: writeFile(log, "Backup Update Log"); michael@0: michael@0: log = dir.clone(); michael@0: log.append(FILE_BACKUP_LOG); michael@0: writeFile(log, "To Be Deleted Backup Update Log"); michael@0: michael@0: log = dir.clone(); michael@0: log.append("0"); michael@0: log.append(FILE_UPDATE_LOG); michael@0: writeFile(log, "Last Update Log"); michael@0: michael@0: standardInit(); michael@0: michael@0: logTestInfo("testing " + log.path + " shouldn't exist"); michael@0: do_check_false(log.exists()); michael@0: michael@0: log = dir.clone(); michael@0: log.append(FILE_LAST_LOG); michael@0: logTestInfo("testing " + log.path + " should exist"); michael@0: do_check_true(log.exists()); michael@0: michael@0: logTestInfo("testing " + log.path + " contents"); michael@0: do_check_eq(readFile(log), "Last Update Log"); michael@0: michael@0: log = dir.clone(); michael@0: log.append(FILE_BACKUP_LOG); michael@0: logTestInfo("testing " + log.path + " should exist"); michael@0: do_check_true(log.exists()); michael@0: michael@0: logTestInfo("testing " + log.path + " contents (bug 470979)"); michael@0: do_check_eq(readFile(log), "Backup Update Log"); michael@0: michael@0: dir.append("0"); michael@0: logTestInfo("testing " + dir.path + " should exist (bug 512994)"); michael@0: do_check_true(dir.exists()); michael@0: michael@0: doTestFinish(); michael@0: }