Wed, 31 Dec 2014 06:09:35 +0100
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 const DIRNAME = "test/";
7 const time = Date.now();
9 function run_test()
10 {
11 // Copy in the test file.
12 var source = do_get_file("data/test.zip");
13 source.copyTo(tmpFile.parent, tmpFile.leafName);
15 // Open it and add something so the CDS is rewritten.
16 zipW.open(tmpFile, PR_RDWR | PR_APPEND);
17 zipW.addEntryDirectory(DIRNAME, time * PR_USEC_PER_MSEC, false);
18 do_check_true(zipW.hasEntry(DIRNAME));
19 zipW.close();
21 var zipR = new ZipReader(tmpFile);
22 do_check_true(zipR.hasEntry(DIRNAME));
23 zipR.close();
25 // Adding the directory would have added a fixed amount to the file size.
26 // Any difference suggests the CDS was written out incorrectly.
27 var extra = ZIP_FILE_HEADER_SIZE + ZIP_CDS_HEADER_SIZE +
28 (DIRNAME.length * 2) + (ZIP_EXTENDED_TIMESTAMP_SIZE * 2);
30 do_check_eq(source.fileSize + extra, tmpFile.fileSize);
31 }