Bug 1146304 - Touch slider bar or tap forward button, the video got stuck 1s then...
[gecko.git] / netwerk / test / unit / test_cache2-24-exists.js
blobfee8a2ee75f17d8119823d1ab80ac49244e25cf9
1 Components.utils.import('resource://gre/modules/LoadContextInfo.jsm');
3 function run_test()
5   do_get_profile();
7   if (!newCacheBackEndUsed()) {
8     do_check_true(true, "This test checks only cache2 specific behavior.");
9     return;
10   }
12   var mc = new MultipleCallbacks(2, function() {
13     var mem = getCacheStorage("memory");
14     var disk = getCacheStorage("disk");
16     do_check_true(disk.exists(createURI("http://m1/"), ""));
17     do_check_true(mem.exists(createURI("http://m1/"), ""));
18     do_check_false(mem.exists(createURI("http://m2/"), ""));
19     do_check_true(disk.exists(createURI("http://d1/"), ""));
20     do_check_throws_nsIException(() => disk.exists(createURI("http://d2/"), ""), 'NS_ERROR_NOT_AVAILABLE');
22     finish_cache2_test();
23   });
25   asyncOpenCacheEntry("http://d1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default,
26     new OpenCallback(NEW | WAITFORWRITE, "meta", "data", function(entry) {
27       mc.fired();
28     })
29   );
31   asyncOpenCacheEntry("http://m1/", "memory", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default,
32     new OpenCallback(NEW | WAITFORWRITE, "meta", "data", function(entry) {
33       mc.fired();
34     })
35   );
37   do_test_pending();