blob: 28a7c1f51a502841be9f1411c8931ab2afe00f56 [file] [log] [blame]
<!-- webkit-test-runner [ enableBackForwardCache=true ] -->
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description('Tests that a page with a closed MediaSource goes into the page cache.');
window.jsTestIsAsync = true;
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() {
// Construct a MediaSource (it is initially in closed state).
mediaSource = new MediaSource();
// This needs to happen outside the onload handler so that a history
// item is created.
setTimeout(function() {
// Force a back navigation back to this page.
window.location.href = "resources/page-cache-helper.html";
}, 0);
}, false);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>