• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<script>
4
5// Helpers.
6
7function log(message) {
8    document.getElementById("console").innerHTML += message + "<br>";
9}
10
11function handleMessage(event) {
12    if (event.data === "created_cache") {
13        log("Origins with application cache after frame was cached: " + layoutTestController.originsWithApplicationCache());
14    } else {
15        log("received invalid message from frame '" + event.data + "'");
16    }
17
18    finishTest();
19}
20
21function addIFrameWithCache()
22{
23    var iframe = document.createElement("iframe");
24    iframe.src = "resources/origins-with-appcache-iframe.html";
25    document.body.appendChild(iframe);
26}
27
28// Start and end.
29
30function startTest() {
31    if (window.layoutTestController) {
32        layoutTestController.clearAllApplicationCaches();
33        log("Origins with application cache after deletion: " + layoutTestController.originsWithApplicationCache());
34        layoutTestController.dumpApplicationCacheDelegateCallbacks();
35        layoutTestController.dumpAsText();
36        layoutTestController.waitUntilDone();
37    }
38
39    window.onmessage = handleMessage;
40
41    addIFrameWithCache();
42}
43
44function finishTest() {
45    if (window.layoutTestController)
46        layoutTestController.notifyDone();
47}
48
49</script>
50</head>
51<body onload="startTest()">
52<p>
53This test verifies that ApplicationCacheStorage can report the set of origins that have an application cache. First, it tests that no origins are reported after all application caches are removed. Then, it loads an iframe that places a PNG into an application cache for the DumpRenderTree origin, and tests that this origin is now reported to have application cache.
54</p>
55<pre id="console"></pre>
56</body>
57</html>
58