1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/test/unit/test_cache2-14b-concurent-readers-complete.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,39 @@ 1.4 +function run_test() 1.5 +{ 1.6 + do_get_profile(); 1.7 + 1.8 + asyncOpenCacheEntry("http://x/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, 1.9 + new OpenCallback(NEW, "x1m", "x1d", function(entry) { 1.10 + // nothing to do here, we expect concurent callbacks to get 1.11 + // all notified, then the test finishes 1.12 + }) 1.13 + ); 1.14 + 1.15 + var mc = new MultipleCallbacks(3, finish_cache2_test); 1.16 + 1.17 + var order = 0; 1.18 + 1.19 + asyncOpenCacheEntry("http://x/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, 1.20 + new OpenCallback(NORMAL|COMPLETE, "x1m", "x1d", function(entry) { 1.21 + ++order; 1.22 + do_check_eq(order, newCacheBackEndUsed() ? 3 : 1); 1.23 + mc.fired(); 1.24 + }) 1.25 + ); 1.26 + asyncOpenCacheEntry("http://x/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, 1.27 + new OpenCallback(NORMAL, "x1m", "x1d", function(entry) { 1.28 + ++order; 1.29 + do_check_eq(order, newCacheBackEndUsed() ? 1 : 2); 1.30 + mc.fired(); 1.31 + }) 1.32 + ); 1.33 + asyncOpenCacheEntry("http://x/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, 1.34 + new OpenCallback(NORMAL, "x1m", "x1d", function(entry) { 1.35 + ++order; 1.36 + do_check_eq(order, newCacheBackEndUsed() ? 2 : 3); 1.37 + mc.fired(); 1.38 + }) 1.39 + ); 1.40 + 1.41 + do_test_pending(); 1.42 +}