blob: 8ce72c96651df81a77e153ff03890a3e48f024b0 [file] [log] [blame]
<!-- webkit-test-runner [ UsesBackForwardCache=true ] -->
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description('Tests that a page with an open WebDatabase with no pending transaction goes into the page cache.');
window.jsTestIsAsync = true;
if (window.testRunner)
testRunner.clearAllDatabases();
window.addEventListener("pageshow", function(event) {
debug("pageshow - " + (event.persisted ? "" : "not ") + "from cache");
if (event.persisted) {
testPassed("Page did enter and was restored from the page cache");
finishJSTest();
}
}, false);
window.addEventListener("pagehide", function(event) {
debug("pagehide - " + (event.persisted ? "" : "not ") + "entering cache");
if (!event.persisted) {
testFailed("Page did not enter the page cache.");
finishJSTest();
}
}, false);
window.addEventListener('load', function() {
// Open the database.
var db = openDatabase("PageCacheTest", "", "Page Cache Test", 10, function (createdDb) {
setTimeout(function() {
window.location.href = "resources/page-cache-helper.html";
}, 0);
});
}, false);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>