blob: 1f5e86a966723f0636cf9cf21fd7c8584322450e [file] [log] [blame]
<html manifest="resources/interrupted-update.manifest">
<p>Test that an application cache update works again after interruption.</p>
<pre id=log></pre>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function log(msg)
{
document.getElementById("log").innerHTML += msg + "\n";
}
var haveReloaded = window.location.hash === "#reloaded";
if (haveReloaded)
log("Reloaded");
function onchecking()
{
log("CHECKING");
}
function ondownloading()
{
log("DOWNLOADING");
}
function onprogress(event)
{
log("PROGRESS " + event.loaded + "/" + event.total);
if (!haveReloaded && event.loaded == 2) {
reloadedLocation = window.location + "#reloaded";
window.location = "/resources/redirect.php?url=" + encodeURIComponent(reloadedLocation);
console.log("Reloading...");
}
}
function onnoupdate()
{
log("NOUPDATE");
log("\nFAIL - the cache was already present, so we couldn't test initial loading");
if (window.testRunner)
testRunner.notifyDone();
}
function oncached()
{
log("CACHED");
log("\nPASS");
if (window.testRunner)
testRunner.notifyDone();
}
function onerror()
{
log("ERROR");
log("\nFAIL");
if (window.testRunner)
testRunner.notifyDone();
}
applicationCache.addEventListener('checking', onchecking, false);
applicationCache.addEventListener('downloading', ondownloading, false);
applicationCache.addEventListener('progress', onprogress, false);
applicationCache.addEventListener('noupdate', onnoupdate, false);
applicationCache.addEventListener('cached', oncached, false);
applicationCache.addEventListener('error', onerror, false);
</script>
</html>