| Index: third_party/WebKit/LayoutTests/media/autoplay-never-visible.html
|
| diff --git a/third_party/WebKit/LayoutTests/media/autoplay-never-visible.html b/third_party/WebKit/LayoutTests/media/autoplay-never-visible.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e9a53ea48324441de06b321dd618eb39f80b6ada
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/media/autoplay-never-visible.html
|
| @@ -0,0 +1,34 @@
|
| +<!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>
|
| +<script src="media-file.js"></script>
|
| +<body>
|
| +<script>
|
| + window.internals.settings.setMediaPlaybackRequiresUserGesture(true);
|
| + window.internals.runtimeFlags.autoplayMutedVideosEnabled = true;
|
| +
|
| + async_test(function(t) {
|
| + // Create a video off screen.
|
| + {
|
| + var video = document.createElement('video');
|
| + video.id = 'offscreen';
|
| + video.src = findMediaFile('video', 'content/test');
|
| + 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>
|
|
|