6 for (i
= 0; i
< 20; i
++) {
12 function write_and_check(str
, data
, len
) {
13 var written
= str
.write(data
, len
);
16 "str.write has not written all data!\n" +
27 function write_datafile(status
, entry
) {
28 Assert
.equal(status
, Cr
.NS_OK
);
29 var data
= gen_1MiB();
30 var os
= entry
.openOutputStream(0, data
.length
);
32 write_and_check(os
, data
, data
.length
);
36 // open, doom, append, read
40 Ci
.nsICacheStorage
.OPEN_NORMALLY
,
46 function test_read_after_doom(status
, entry
) {
47 Assert
.equal(status
, Cr
.NS_OK
);
48 var data
= gen_1MiB();
49 var os
= entry
.openOutputStream(entry
.dataSize
, data
.length
);
51 entry
.asyncDoom(null);
52 write_and_check(os
, data
, data
.length
);
56 var is
= entry
.openInputStream(0);
57 pumpReadStream(is
, function (read
) {
58 Assert
.equal(read
.length
, 2 * 1024 * 1024);
69 evict_cache_entries();
74 Ci
.nsICacheStorage
.OPEN_NORMALLY
,