netwerk/test/unit/test_cache2-14b-concurent-readers-complete.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 function run_test()
michael@0 2 {
michael@0 3 do_get_profile();
michael@0 4
michael@0 5 asyncOpenCacheEntry("http://x/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
michael@0 6 new OpenCallback(NEW, "x1m", "x1d", function(entry) {
michael@0 7 // nothing to do here, we expect concurent callbacks to get
michael@0 8 // all notified, then the test finishes
michael@0 9 })
michael@0 10 );
michael@0 11
michael@0 12 var mc = new MultipleCallbacks(3, finish_cache2_test);
michael@0 13
michael@0 14 var order = 0;
michael@0 15
michael@0 16 asyncOpenCacheEntry("http://x/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
michael@0 17 new OpenCallback(NORMAL|COMPLETE, "x1m", "x1d", function(entry) {
michael@0 18 ++order;
michael@0 19 do_check_eq(order, newCacheBackEndUsed() ? 3 : 1);
michael@0 20 mc.fired();
michael@0 21 })
michael@0 22 );
michael@0 23 asyncOpenCacheEntry("http://x/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
michael@0 24 new OpenCallback(NORMAL, "x1m", "x1d", function(entry) {
michael@0 25 ++order;
michael@0 26 do_check_eq(order, newCacheBackEndUsed() ? 1 : 2);
michael@0 27 mc.fired();
michael@0 28 })
michael@0 29 );
michael@0 30 asyncOpenCacheEntry("http://x/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
michael@0 31 new OpenCallback(NORMAL, "x1m", "x1d", function(entry) {
michael@0 32 ++order;
michael@0 33 do_check_eq(order, newCacheBackEndUsed() ? 2 : 3);
michael@0 34 mc.fired();
michael@0 35 })
michael@0 36 );
michael@0 37
michael@0 38 do_test_pending();
michael@0 39 }

mercurial