netwerk/test/unit/test_cache2-12-evict-disk.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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   var mc = new MultipleCallbacks(3, function() {
    11     var storage = getCacheStorage("disk");
    12     storage.asyncEvictStorage(
    13       new EvictionCallback(true, function() {
    14         storage.asyncVisitStorage(
    15           new VisitCallback(0, 0, [], function() {
    16             var storage = getCacheStorage("memory");
    17             storage.asyncVisitStorage(
    18               new VisitCallback(0, 0, [], function() {
    19                 finish_cache2_test();
    20               }),
    21               true
    22             );
    23           }),
    24           true
    25         );
    26       })
    27     );
    28   }, !newCacheBackEndUsed());
    30   asyncOpenCacheEntry("http://mem1/", "memory", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    31     new OpenCallback(NEW, "m2m", "m2d", function(entry) {
    32       asyncOpenCacheEntry("http://mem1/", "memory", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    33         new OpenCallback(NORMAL, "m2m", "m2d", function(entry) {
    34           mc.fired();
    35         })
    36       );
    37     })
    38   );
    40   asyncOpenCacheEntry("http://a/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    41     new OpenCallback(NEW, "a1m", "a1d", function(entry) {
    42       asyncOpenCacheEntry("http://a/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    43         new OpenCallback(NORMAL, "a1m", "a1d", function(entry) {
    44           mc.fired();
    45         })
    46       );
    47     })
    48   );
    50   asyncOpenCacheEntry("http://b/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    51     new OpenCallback(NEW, "b1m", "b1d", function(entry) {
    52       asyncOpenCacheEntry("http://b/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    53         new OpenCallback(NORMAL, "b1m", "b1d", function(entry) {
    54           mc.fired();
    55         })
    56       );
    57     })
    58   );
    60   do_test_pending();
    61 }

mercurial