blob: 2d21d8c2c63aa3396a986f2fa7032452e9ea887e [file] [log] [blame]
<html>
<head>
<script>
// Helpers.
function log(message) {
document.getElementById("console").innerHTML += message + "<br>";
}
// Start and end.
function startTest() {
if (window.testRunner) {
testRunner.clearAllApplicationCaches();
testRunner.dumpApplicationCacheDelegateCallbacks();
if (window.internals)
internals.setApplicationCacheOriginQuota(20*1024);
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
addFirstIFrame();
}
function finishTest() {
if (window.testRunner)
testRunner.notifyDone();
}
// Stages.
function addIFrameWithContinuation(src, continuation) {
window.onmessage = continuation;
var iframe = document.createElement("iframe");
iframe.src = src;
document.body.appendChild(iframe);
}
function addFirstIFrame() {
// Expected to succeed. Will be ~15kb out of the 20kb limit.
addIFrameWithContinuation("resources/quota-origin-continued-download-multiple-manifests-1.html", function(event) {
log(event.data);
addSecondIFrame();
});
}
function addSecondIFrame() {
// Expected to succeed, due to automatically increasing the quota.
addIFrameWithContinuation("resources/quota-origin-continued-download-multiple-manifests-2.html", function(event) {
log(event.data);
finishTest();
});
}
</script>
</head>
<body onload="startTest()">
<p>This test checks that per-origin application cache quota works correctly with multiple manifests/caches per-origin.</p>
<p>
This test sets the quota for the origin to 20kb, and attempts to fill
it up with 2 different application caches about 15kb each.
The first frame will cache successfully and fill up about 15kb of
the origin quota.
The second frame will reach the quota, cause a delegate callback,
dump the totalSpaceNeeded. The space needed should be enough for both
iframe caches, so we would expect ~30kb bytes. The delegate will
automatically increase the quota and cause the second appcache
to succeed.
</p>
<pre id="console"></pre>
</body>
</html>