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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/modules/libjar/zipwriter/test/unit/head_zipwriter.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,46 @@
     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 Ci = Components.interfaces;
    1.10 +const Cc = Components.classes;
    1.11 +const NS_ERROR_IN_PROGRESS = 2152398863;
    1.12 +
    1.13 +const PR_RDONLY      = 0x01
    1.14 +const PR_WRONLY      = 0x02
    1.15 +const PR_RDWR        = 0x04
    1.16 +const PR_CREATE_FILE = 0x08
    1.17 +const PR_APPEND      = 0x10
    1.18 +const PR_TRUNCATE    = 0x20
    1.19 +const PR_SYNC        = 0x40
    1.20 +const PR_EXCL        = 0x80
    1.21 +
    1.22 +const ZIP_EOCDR_HEADER_SIZE = 22;
    1.23 +const ZIP_FILE_HEADER_SIZE = 30;
    1.24 +const ZIP_CDS_HEADER_SIZE = 46;
    1.25 +const ZIP_METHOD_STORE = 0
    1.26 +const ZIP_METHOD_DEFLATE = 8
    1.27 +const ZIP_EXTENDED_TIMESTAMP_SIZE = 9;
    1.28 +
    1.29 +const PR_USEC_PER_MSEC = 1000;
    1.30 +const PR_USEC_PER_SEC  = 1000000;
    1.31 +const PR_MSEC_PER_SEC  = 1000;
    1.32 +
    1.33 +const DATA_DIR = "data/";
    1.34 +
    1.35 +var ioSvc = Cc["@mozilla.org/network/io-service;1"]
    1.36 +             .getService(Ci.nsIIOService);
    1.37 +
    1.38 +var ZipWriter = Components.Constructor("@mozilla.org/zipwriter;1",
    1.39 +                                       "nsIZipWriter");
    1.40 +var ZipReader = Components.Constructor("@mozilla.org/libjar/zip-reader;1",
    1.41 +                                       "nsIZipReader", "open");
    1.42 +
    1.43 +var tmpDir = do_get_profile();
    1.44 +var tmpFile = tmpDir.clone();
    1.45 +tmpFile.append("zipwriter-test.zip");
    1.46 +if (tmpFile.exists())
    1.47 +  tmpFile.remove(true);
    1.48 +
    1.49 +var zipW = new ZipWriter();

mercurial