blob: 78f3797332ea0e6647652c15422a7961b508b1c9 [file] [log] [blame]
<html>
<head>
<script src="media-file.js"></script>
<script src="video-test.js"></script>
<script>
if (window.internals)
internals.settings.setInvisibleAutoplayNotPermitted(true);
function start()
{
findMediaElement();
consoleWrite('** setting video source.src');
var source = document.createElement('source');
source.src = findMediaFile('video', 'content/test');
video.appendChild(source);
video.muted = true;
waitForEventOnce('play', play1);
consoleWrite('');
}
function play1()
{
run('video.style.display = "none"');
waitForEventOnce('pause', pause1);
}
function pause1()
{
run('video.style.removeProperty("display")')
waitForEventOnce('play', play2);
}
function play2()
{
run('video.style.visibility = "hidden"');
waitForEventOnce('pause', pause2);
}
function pause2()
{
run('video.style.removeProperty("visibility")');
waitForEventOnce('play', play3);
}
function play3()
{
run('document.documentElement.style.height = window.innerHeight + 20 + video.offsetHeight');
run('window.scrollBy(0, 20 + video.offsetHeight)');
waitForEventOnce('pause', pause3);
}
function pause3()
{
run('window.scrollTo(0, 0)');
waitForEventOnce('play', endTest);
}
</script>
</head>
<body onload="start()">
<video autoplay></video>
<p>Test that "invisible autoplay not allowed restriction" pauses media when scrolled out of view.</p>
</body>
</html>