blob: 3765e05eb3bd3d604b5b61fe390f4673b62f2e3c [file] [log] [blame]
<!DOCTYPE html>
<title>Test behaviour of autoplay muted videos with regards to visibility</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<body>
<script>
window.internals.settings.setAutoplayPolicy('user-gesture-required');
window.internals.runtimeFlags.autoplayMutedVideosEnabled = true;
async_test(function(t) {
// Create a video off screen.
{
var video = document.createElement('video');
video.id = 'offscreen';
video.src = 'content/test.ogv';
video.muted = true;
video.autoplay = true;
video.loop = true;
video.style.position = 'absolute';
video.style.top = '-10000px';
document.body.appendChild(video);
}
var offscreen = document.querySelector('#offscreen');
offscreen.addEventListener('canplay', t.step_func_done(function() {
// The offscreen videos shouldn't play.
assert_true(offscreen.paused);
assert_greater_than_equal(offscreen.readyState, HTMLMediaElement.HAVE_ENOUGH_DATA);
}));
}, "Test that muted video with an autoplay attribute does not leak if it's never visible");
</script>
</body>