blob: 85cc316cf9c15dacd6b9e5b356e2d9d6adef137b [file] [log] [blame]
<!-- webkit-test-runner [ enablePageCache=true ] -->
<!DOCTYPE html>
<html>
<head>
<title>mock-media-source</title>
<script src="mock-media-source.js"></script>
<script src="../video-test.js"></script>
<script>
var source;
var sourceBuffer;
if (window.internals)
internals.initializeMockMediaSource();
window.addEventListener("pageshow", function(event) {
consoleWrite("pageshow - " + (event.persisted ? "" : "not ") + "from cache");
if (event.persisted) {
consoleWrite("PASS: Page was restored from Page Cache");
endTest();
}
});
window.addEventListener("pagehide", function(event) {
consoleWrite("pagehide - " + (event.persisted ? "" : "not ") + "entering cache");
if (!event.persisted) {
consoleWrite("FAIL: Page failed to enter the Page Cache");
endTest();
}
});
function runTest() {
findMediaElement();
source = new MediaSource();
waitForEvent('sourceopen', sourceOpen, false, false, source);
run('video.src = URL.createObjectURL(source)');
}
function sourceOpen() {
run('sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock")');
testExpected('source.sourceBuffers[0]', sourceBuffer);
testLink.click();
}
</script>
</head>
<body onload="runTest()">
<video></video>
<a id="testLink" href="../../fast/history/resources/page-cache-helper.html" style="display: none">Link</a>
</body>
</html>