summaryrefslogtreecommitdiffstats
path: root/netwerk/test/unit/test_cache2-14-concurent-readers.js
blob: 7355a2a9e8bb476247e1e6403df8e964a36384e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function run_test()
{
  do_get_profile();

  asyncOpenCacheEntry("http://x/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    new OpenCallback(NEW, "x1m", "x1d", function(entry) {
      // nothing to do here, we expect concurent callbacks to get
      // all notified, then the test finishes
    })
  );

  var mc = new MultipleCallbacks(3, finish_cache2_test);

  asyncOpenCacheEntry("http://x/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    new OpenCallback(NORMAL, "x1m", "x1d", function(entry) {
      mc.fired();
    })
  );
  asyncOpenCacheEntry("http://x/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    new OpenCallback(NORMAL, "x1m", "x1d", function(entry) {
      mc.fired();
    })
  );
  asyncOpenCacheEntry("http://x/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    new OpenCallback(NORMAL, "x1m", "x1d", function(entry) {
      mc.fired();
    })
  );

  do_test_pending();
}