netwerk/test/unit/test_cache2-22-anon-visit.js

Wed, 31 Dec 2014 06:55:46 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:46 +0100
changeset 1
ca08bd8f51b2
permissions
-rw-r--r--

Added tag TORBROWSER_REPLICA for changeset 6474c204b198

michael@0 1 Components.utils.import('resource://gre/modules/LoadContextInfo.jsm');
michael@0 2
michael@0 3 function run_test()
michael@0 4 {
michael@0 5 do_get_profile();
michael@0 6
michael@0 7 function checkNewBackEnd()
michael@0 8 {
michael@0 9 var storage = getCacheStorage("disk", LoadContextInfo.default);
michael@0 10 storage.asyncVisitStorage(
michael@0 11 new VisitCallback(1, 12, ["http://an2/"], function() {
michael@0 12 storage = getCacheStorage("disk", LoadContextInfo.anonymous);
michael@0 13 storage.asyncVisitStorage(
michael@0 14 new VisitCallback(1, 12, ["http://an2/"], function() {
michael@0 15 finish_cache2_test();
michael@0 16 }),
michael@0 17 true
michael@0 18 );
michael@0 19 }),
michael@0 20 true
michael@0 21 );
michael@0 22 }
michael@0 23
michael@0 24 function checkOldBackEnd()
michael@0 25 {
michael@0 26 syncWithCacheIOThread(function() {
michael@0 27 var storage = getCacheStorage("disk", LoadContextInfo.default);
michael@0 28 storage.asyncVisitStorage(
michael@0 29 new VisitCallback(2, 24, ["http://an2/", "anon&uri=http://an2/"], function() {
michael@0 30 storage = getCacheStorage("disk", LoadContextInfo.anonymous);
michael@0 31 storage.asyncVisitStorage(
michael@0 32 new VisitCallback(0, 0, [], function() {
michael@0 33 finish_cache2_test();
michael@0 34 }),
michael@0 35 true
michael@0 36 );
michael@0 37 }),
michael@0 38 true
michael@0 39 );
michael@0 40 });
michael@0 41 }
michael@0 42
michael@0 43 var mc = new MultipleCallbacks(2, newCacheBackEndUsed() ? checkNewBackEnd : checkOldBackEnd, !newCacheBackEndUsed());
michael@0 44
michael@0 45 asyncOpenCacheEntry("http://an2/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default,
michael@0 46 new OpenCallback(NEW|WAITFORWRITE, "an2", "an2", function(entry) {
michael@0 47 mc.fired();
michael@0 48 })
michael@0 49 );
michael@0 50
michael@0 51 asyncOpenCacheEntry("http://an2/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.anonymous,
michael@0 52 new OpenCallback(NEW|WAITFORWRITE, "an2", "an2", function(entry) {
michael@0 53 mc.fired();
michael@0 54 })
michael@0 55 );
michael@0 56
michael@0 57 do_test_pending();
michael@0 58 }

mercurial