michael@0: function run_test() michael@0: { michael@0: do_get_profile(); michael@0: michael@0: // Open for write, write michael@0: asyncOpenCacheEntry("http://304/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, michael@0: new OpenCallback(NEW, "31m", "31d", function(entry) { michael@0: // Open normally but wait for validation from the server michael@0: asyncOpenCacheEntry("http://304/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, michael@0: new OpenCallback(REVAL, "31m", "31d", function(entry) { michael@0: // emulate 304 from the server michael@0: do_execute_soon(function() { michael@0: entry.setValid(); // this will trigger OpenCallbacks bellow michael@0: }); michael@0: }) michael@0: ); michael@0: michael@0: var mc = new MultipleCallbacks(3, finish_cache2_test); michael@0: michael@0: asyncOpenCacheEntry("http://304/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, michael@0: new OpenCallback(NORMAL, "31m", "31d", function(entry) { michael@0: mc.fired(); michael@0: }) michael@0: ); michael@0: asyncOpenCacheEntry("http://304/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, michael@0: new OpenCallback(NORMAL, "31m", "31d", function(entry) { michael@0: mc.fired(); michael@0: }) michael@0: ); michael@0: asyncOpenCacheEntry("http://304/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, michael@0: new OpenCallback(NORMAL, "31m", "31d", function(entry) { michael@0: mc.fired(); michael@0: }) michael@0: ); michael@0: }) michael@0: ); michael@0: michael@0: do_test_pending(); michael@0: }