1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/modules/libjar/zipwriter/test/unit/test_asyncbadadd.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,35 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + */ 1.8 + 1.9 +const FILENAME = "missing.txt"; 1.10 + 1.11 +var observer = { 1.12 + onStartRequest: function(request, context) 1.13 + { 1.14 + }, 1.15 + 1.16 + onStopRequest: function(request, context, status) 1.17 + { 1.18 + do_check_eq(status, Components.results.NS_ERROR_FILE_NOT_FOUND); 1.19 + zipW.close(); 1.20 + do_check_eq(ZIP_EOCDR_HEADER_SIZE, tmpFile.fileSize); 1.21 + do_test_finished(); 1.22 + } 1.23 +}; 1.24 + 1.25 +function run_test() 1.26 +{ 1.27 + zipW.open(tmpFile, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE); 1.28 + 1.29 + var source = tmpDir.clone(); 1.30 + source.append(FILENAME); 1.31 + zipW.addEntryFile(FILENAME, Ci.nsIZipWriter.COMPRESSION_NONE, source, true); 1.32 + 1.33 + do_test_pending(); 1.34 + zipW.processQueue(observer, null); 1.35 + 1.36 + // With nothing to actually do the queue would have completed immediately 1.37 + do_check_false(zipW.inQueue); 1.38 +}