modules/libjar/zipwriter/test/unit/test_asyncremove.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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  */
     6 var TESTS = [
     7   "test.txt",
     8   "test.png"
     9 ];
    11 var observer = {
    12   onStartRequest: function(request, context)
    13   {
    14   },
    16   onStopRequest: function(request, context, status)
    17   {
    18     do_check_eq(status, Components.results.NS_OK);
    20     zipW.close();
    22     // Empty zip file should just be the end of central directory marker
    23     var newTmpFile = tmpFile.clone();
    24     do_check_eq(newTmpFile.fileSize, ZIP_EOCDR_HEADER_SIZE);
    25     do_test_finished();
    26   }
    27 };
    29 function run_test()
    30 {
    31   // Copy our test zip to the tmp dir so we can modify it
    32   var testzip = do_get_file(DATA_DIR + "test.zip");
    33   testzip.copyTo(tmpDir, tmpFile.leafName);
    35   do_check_true(tmpFile.exists());
    37   zipW.open(tmpFile, PR_RDWR);
    39   for (var i = 0; i < TESTS.length; i++) {
    40     do_check_true(zipW.hasEntry(TESTS[i]));
    41     zipW.removeEntry(TESTS[i], true);
    42   }
    44   do_test_pending();
    45   zipW.processQueue(observer, null);
    46   do_check_true(zipW.inQueue);
    47 }

mercurial