michael@0: function run_test() michael@0: { michael@0: do_get_profile(); michael@0: michael@0: var storage = getCacheStorage("disk"); michael@0: var mc = new MultipleCallbacks(4, function() { michael@0: syncWithCacheIOThread(function() { michael@0: storage.asyncVisitStorage( michael@0: // Test should store 4 entries michael@0: new VisitCallback(4, 48, ["http://a/", "http://b/", "http://c/", "http://d/"], function() { michael@0: storage.asyncVisitStorage( michael@0: // Still 4 entries expected, now don't walk them michael@0: new VisitCallback(4, 48, null, function() { michael@0: finish_cache2_test(); michael@0: }), michael@0: false michael@0: ); michael@0: }), michael@0: true michael@0: ); michael@0: }); michael@0: }, !newCacheBackEndUsed()); michael@0: michael@0: asyncOpenCacheEntry("http://a/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, michael@0: new OpenCallback(NEW, "a1m", "a1d", function(entry) { michael@0: asyncOpenCacheEntry("http://a/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, michael@0: new OpenCallback(NORMAL, "a1m", "a1d", function(entry) { michael@0: mc.fired(); michael@0: }) michael@0: ); michael@0: }) michael@0: ); michael@0: michael@0: asyncOpenCacheEntry("http://b/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, michael@0: new OpenCallback(NEW, "b1m", "b1d", function(entry) { michael@0: asyncOpenCacheEntry("http://b/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, michael@0: new OpenCallback(NORMAL, "b1m", "b1d", function(entry) { michael@0: mc.fired(); michael@0: }) michael@0: ); michael@0: }) michael@0: ); michael@0: michael@0: asyncOpenCacheEntry("http://c/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, michael@0: new OpenCallback(NEW, "c1m", "c1d", function(entry) { michael@0: asyncOpenCacheEntry("http://c/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, michael@0: new OpenCallback(NORMAL, "c1m", "c1d", function(entry) { michael@0: mc.fired(); michael@0: }) michael@0: ); michael@0: }) michael@0: ); michael@0: michael@0: asyncOpenCacheEntry("http://d/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, michael@0: new OpenCallback(NEW, "d1m", "d1d", function(entry) { michael@0: asyncOpenCacheEntry("http://d/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, michael@0: new OpenCallback(NORMAL, "d1m", "d1d", function(entry) { michael@0: mc.fired(); michael@0: }) michael@0: ); michael@0: }) michael@0: ); michael@0: michael@0: do_test_pending(); michael@0: }