blob: 8c5feed157d41f4c10d8c1630627e1100a7cab80 [file] [log] [blame]
<html>
<body>
<p>Test that offline applications work when there is no network access (simulated).</p>
<p>Should say SUCCESS:</p>
<div id=result></div>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function log(message)
{
document.getElementById("result").innerHTML += message + "<br>";
}
function setNetworkEnabled(state)
{
var req = new XMLHttpRequest;
req.open("GET", "/resources/network-simulator.py?test=appcache-offline-access&command=" + (state ? "connect" : "disconnect"), false);
req.send("");
}
function createFrame()
{
var ifr = document.createElement("iframe");
ifr.setAttribute("src", "/resources/network-simulator.py?test=appcache-offline-access&path=/appcache/resources/offline-access-frame.html");
document.body.appendChild(ifr);
}
function frameCreated()
{
if (stage == 0) {
stage = 1;
setNetworkEnabled(false);
createFrame();
} else if (stage == 1) {
stage = 2;
setNetworkEnabled(true);
createFrame();
} else {
log("SUCCESS");
if (window.testRunner)
testRunner.notifyDone()
}
}
window.addEventListener("message", frameCreated, false);
var stage = 0;
setNetworkEnabled(true);
createFrame();
</script>
</body>
</html>