Bug 1857386 [wpt PR 42383] - Update wpt metadata, a=testonly
[gecko.git] / netwerk / test / unit / test_cache2-19-range-206.js
blobf3f94919324e6149aad55272ae336f881efe5eaa
1 "use strict";
3 function run_test() {
4   do_get_profile();
6   // Open for write, write
7   asyncOpenCacheEntry(
8     "http://r206/",
9     "disk",
10     Ci.nsICacheStorage.OPEN_NORMALLY,
11     null,
12     new OpenCallback(NEW, "206m", "206part1-", function () {
13       // Open normally but wait for validation from the server
14       asyncOpenCacheEntry(
15         "http://r206/",
16         "disk",
17         Ci.nsICacheStorage.OPEN_NORMALLY,
18         null,
19         new OpenCallback(PARTIAL, "206m", "206part1-", function (entry) {
20           // emulate 206 from the server, i.e. resume transaction and write content to the output stream
21           new OpenCallback(
22             NEW | WAITFORWRITE | PARTIAL,
23             "206m",
24             "-part2",
25             function (entry1) {
26               entry1.setValid();
27             }
28           ).onCacheEntryAvailable(entry, true, Cr.NS_OK);
29         })
30       );
32       var mc = new MultipleCallbacks(3, finish_cache2_test);
34       asyncOpenCacheEntry(
35         "http://r206/",
36         "disk",
37         Ci.nsICacheStorage.OPEN_NORMALLY,
38         null,
39         new OpenCallback(NORMAL, "206m", "206part1--part2", function (entry) {
40           mc.fired();
41         })
42       );
43       asyncOpenCacheEntry(
44         "http://r206/",
45         "disk",
46         Ci.nsICacheStorage.OPEN_NORMALLY,
47         null,
48         new OpenCallback(NORMAL, "206m", "206part1--part2", function (entry) {
49           mc.fired();
50         })
51       );
52       asyncOpenCacheEntry(
53         "http://r206/",
54         "disk",
55         Ci.nsICacheStorage.OPEN_NORMALLY,
56         null,
57         new OpenCallback(NORMAL, "206m", "206part1--part2", function (entry) {
58           mc.fired();
59         })
60       );
61     })
62   );
64   do_test_pending();