Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
1 function run_test()
2 {
3 do_get_profile();
5 if (!newCacheBackEndUsed()) {
6 do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
7 return;
8 }
10 // Open for write, write
11 asyncOpenCacheEntry("http://200/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
12 new OpenCallback(NEW, "21m", "21d", function(entry) {
13 asyncOpenCacheEntry("http://200/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
14 new OpenCallback(NORMAL, "21m", "21d", function(entry) {
15 // Open normally but wait for validation from the server
16 asyncOpenCacheEntry("http://200/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
17 new OpenCallback(REVAL, "21m", "21d", function(entry) {
18 // emulate 200 from server (new content)
19 do_execute_soon(function() {
20 var entry2 = entry.recreate();
22 // now fill the new entry, use OpenCallback directly for it
23 (new OpenCallback(NEW, "22m", "22d", function() {}))
24 .onCacheEntryAvailable(entry2, true, null, Cr.NS_OK);
25 });
26 })
27 );
29 var mc = new MultipleCallbacks(3, finish_cache2_test);
31 asyncOpenCacheEntry("http://200/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
32 new OpenCallback(NORMAL, "22m", "22d", function(entry) {
33 mc.fired();
34 })
35 );
36 asyncOpenCacheEntry("http://200/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
37 new OpenCallback(NORMAL, "22m", "22d", function(entry) {
38 mc.fired();
39 })
40 );
41 asyncOpenCacheEntry("http://200/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
42 new OpenCallback(NORMAL, "22m", "22d", function(entry) {
43 mc.fired();
44 })
45 );
46 })
47 );
48 })
49 );
51 do_test_pending();
52 }