blob: 6d31f51029fe79b4ef91209861565f8fad53ba03 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="media-file.js"></script>
<script src="video-test.js"></script>
<script>
function go()
{
runNextTest();
}
function runNextTest()
{
if (tests.length)
tests.shift()();
else
endTest();
}
function testPlaysInline(requiresPlaysInline, hasPlaysInline, expectedDisplayingFullscreen)
{
run('internals.settings.setInlineMediaPlaybackRequiresPlaysInlineAttribute(' + requiresPlaysInline + ')');
video = media = document.createElement('video');
document.body.appendChild(video);
video.controls = true;
video.src = findMediaFile('video', 'content/test');
run('video.playsInline = ' + hasPlaysInline);
waitForEventOnce('canplaythrough', () => {
runWithKeyDown(() => {
run('video.play()');
});
})
waitForEventOnce('playing', async () => {
if (expectedDisplayingFullscreen) {
await testExpectedEventually('internals.isChangingPresentationMode(video)', false);
// The GTK/WPE ports take a while to complete the fullscreen change. Wait until the next mainloop iteration.
await new Promise(resolve => setTimeout(resolve, 0));
}
testExpected('video.webkitDisplayingFullscreen', expectedDisplayingFullscreen);
document.body.removeChild(video);
runNextTest();
});
}
function testRequiresPlaysInlineAndDoesntHaveIt()
{
testPlaysInline(true, false, true);
}
function testRequiresPlaysInlineAndDoesHaveIt()
{
testPlaysInline(true, true, false);
}
function testDoesNotRequirePlaysInlineAndDoesntHaveIt()
{
testPlaysInline(false, false, false);
}
function testDoesNotRequirePlaysInlineAndDoesHaveIt()
{
testPlaysInline(false, true, false);
}
var tests = [
testRequiresPlaysInlineAndDoesntHaveIt,
testRequiresPlaysInlineAndDoesHaveIt,
testDoesNotRequirePlaysInlineAndDoesntHaveIt,
testDoesNotRequirePlaysInlineAndDoesHaveIt,
];
</script>
</head>
<body onload="go()">
</body>
</html>