blob: 33445d55b434424821a464ef3f8c1109570b7246 [file] [log] [blame]
<!-- webkit-test-runner [ UsesBackForwardCache=true ] -->
<!DOCTYPE html>
<html>
<body>
<video id="video" autoplay=""></video>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="routines.js"></script>
<script>
t = async_test();
window.addEventListener("pageshow", function(event) {
if (!event.persisted)
return;
assert_equals(t.pc1.connectionState, "connected");
t.done();
});
window.addEventListener("pagehide", t.step_func((event) => {
assert_equals(t.pc1.connectionState, "connected");
if (!event.persisted)
assert_uneached("Page failed to enter page cache");
}));
onload = () => {
setTimeout(async () => {
const localStream = await navigator.mediaDevices.getUserMedia({video: true });
const stream = await new Promise((resolve, reject) => {
createConnections((firstConnection) => {
t.pc1 = firstConnection;
firstConnection.addTrack(localStream.getVideoTracks()[0], localStream);
}, (secondConnection) => {
t.pc2 = secondConnection;
secondConnection.ontrack = (trackEvent) => {
resolve(trackEvent.streams[0]);
};
});
setTimeout(() => reject("Test timed out"), 5000);
});
video.srcObject = stream;
await video.play();
window.location = "../fast/history/resources/page-cache-helper.html";
}, 0);
};
</script>
</html>