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: var TESTS = [ michael@0: "test.txt", michael@0: "test.png" michael@0: ]; michael@0: michael@0: var observer = { michael@0: onStartRequest: function(request, context) michael@0: { michael@0: }, michael@0: michael@0: onStopRequest: function(request, context, status) michael@0: { michael@0: do_check_eq(status, Components.results.NS_OK); michael@0: michael@0: zipW.close(); michael@0: michael@0: // Empty zip file should just be the end of central directory marker michael@0: var newTmpFile = tmpFile.clone(); michael@0: do_check_eq(newTmpFile.fileSize, ZIP_EOCDR_HEADER_SIZE); michael@0: do_test_finished(); michael@0: } michael@0: }; michael@0: michael@0: function run_test() michael@0: { michael@0: // Copy our test zip to the tmp dir so we can modify it michael@0: var testzip = do_get_file(DATA_DIR + "test.zip"); michael@0: testzip.copyTo(tmpDir, tmpFile.leafName); michael@0: michael@0: do_check_true(tmpFile.exists()); michael@0: michael@0: zipW.open(tmpFile, PR_RDWR); michael@0: michael@0: for (var i = 0; i < TESTS.length; i++) { michael@0: do_check_true(zipW.hasEntry(TESTS[i])); michael@0: zipW.removeEntry(TESTS[i], true); michael@0: } michael@0: michael@0: do_test_pending(); michael@0: zipW.processQueue(observer, null); michael@0: do_check_true(zipW.inQueue); michael@0: }