diff options
Diffstat (limited to 'LayoutTests/http/tests/appcache/top-frame-4.html')
-rw-r--r-- | LayoutTests/http/tests/appcache/top-frame-4.html | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/LayoutTests/http/tests/appcache/top-frame-4.html b/LayoutTests/http/tests/appcache/top-frame-4.html new file mode 100644 index 0000000..39743b9 --- /dev/null +++ b/LayoutTests/http/tests/appcache/top-frame-4.html @@ -0,0 +1,60 @@ +<html manifest="resources/subframes-4.manifest"> +<body> +<p>Test that a subframe with manifest that matches top frame manifest works correctly.</p> +<p>In this case, the subframe resource is listed in manifest explicitly.</p> +<p>Should say SUCCESS:</p> +<div id=result></div> + +<script> +if (window.layoutTestController) { + layoutTestController.dumpAsText(); + layoutTestController.waitUntilDone(); +} + +function log(message) +{ + document.getElementById("result").innerHTML += message + "<br>"; +} + +function test() +{ + applicationCache.onnoupdate = null; + applicationCache.oncached = null; + + // When a new main resource is associated with the cache, an update should be started. + applicationCache.onchecking = function() { log("checking") } + + var ifr = document.createElement("iframe"); + ifr.setAttribute("src", "resources/subframe-4.html"); + document.body.appendChild(ifr); +} + +function test2() +{ + window.removeEventListener("message", test2, false); + window.addEventListener("message", test3, false); + + // Add an identical frame, to test that loading its resources from appcache works. + var ifr = document.createElement("iframe"); + ifr.setAttribute("src", "resources/subframe-4.html"); + document.body.appendChild(ifr); +} + +function test3() +{ + log("SUCCESS"); + if (window.layoutTestController) + layoutTestController.notifyDone(); +} + +applicationCache.onnoupdate = function() { test() } +applicationCache.oncached = function() { test() } + +applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") } +applicationCache.onerror = function() { log("FAIL: received unexpected error event") } + +window.addEventListener("message", test2, false); + +</script> +</body> +</html> |