1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/test/unit/test_cache2-18-not-valid.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,30 @@ 1.4 +function run_test() 1.5 +{ 1.6 + do_get_profile(); 1.7 + 1.8 + if (!newCacheBackEndUsed()) { 1.9 + do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different"); 1.10 + return; 1.11 + } 1.12 + 1.13 + // Open for write, write but expect it to fail, since other callback will recreate (and doom) 1.14 + // the first entry before it opens output stream (note: in case of problems the DOOMED flag 1.15 + // can be removed, it is not the test failure when opening the output stream on recreated entry. 1.16 + asyncOpenCacheEntry("http://nv/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, 1.17 + new OpenCallback(NEW|DOOMED, "v1m", "v1d", function(entry) { 1.18 + // Open for rewrite (don't validate), write different meta and data 1.19 + asyncOpenCacheEntry("http://nv/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, 1.20 + new OpenCallback(NOTVALID|RECREATE, "v2m", "v2d", function(entry) { 1.21 + // And check... 1.22 + asyncOpenCacheEntry("http://nv/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, 1.23 + new OpenCallback(NORMAL, "v2m", "v2d", function(entry) { 1.24 + finish_cache2_test(); 1.25 + }) 1.26 + ); 1.27 + }) 1.28 + ); 1.29 + }) 1.30 + ); 1.31 + 1.32 + do_test_pending(); 1.33 +}