netwerk/test/unit/test_cache2-19-range-206.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 function run_test()
     2 {
     3   do_get_profile();
     5   if (!newCacheBackEndUsed()) {
     6     do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
     7     return;
     8   }
    10   // Open for write, write
    11   asyncOpenCacheEntry("http://r206/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    12     new OpenCallback(NEW, "206m", "206part1-", function(entry) {
    13       // Open normally but wait for validation from the server
    14       asyncOpenCacheEntry("http://r206/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    15         new OpenCallback(PARTIAL, "206m", "206part1-", function(entry) {
    16           // emulate 206 from the server, i.e. resume transaction and write content to the output stream
    17           (new OpenCallback(NEW|WAITFORWRITE|PARTIAL, "206m", "-part2", function(entry) {
    18             entry.setValid();
    19           })).onCacheEntryAvailable(entry, true, null, Cr.NS_OK);
    20         })
    21       );
    23       var mc = new MultipleCallbacks(3, finish_cache2_test);
    25       asyncOpenCacheEntry("http://r206/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    26         new OpenCallback(NORMAL, "206m", "206part1--part2", function(entry) {
    27           mc.fired();
    28         })
    29       );
    30       asyncOpenCacheEntry("http://r206/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    31         new OpenCallback(NORMAL, "206m", "206part1--part2", function(entry) {
    32           mc.fired();
    33         })
    34       );
    35       asyncOpenCacheEntry("http://r206/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    36         new OpenCallback(NORMAL, "206m", "206part1--part2", function(entry) {
    37           mc.fired();
    38         })
    39       );
    40     })
    41   );
    43   do_test_pending();
    44 }

mercurial