| Index: third_party/WebKit/LayoutTests/media/autoplay-document-move.html
|
| diff --git a/third_party/WebKit/LayoutTests/media/autoplay-document-move.html b/third_party/WebKit/LayoutTests/media/autoplay-document-move.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..962a5f4611d0596cdb7a68564f6a89923eec13c5
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/media/autoplay-document-move.html
|
| @@ -0,0 +1,43 @@
|
| +<!DOCTYPE html>
|
| +<title>Moving media element to other document to bypass autoplay</title>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<script src="media-file.js"></script>
|
| +<body>
|
| +<script>
|
| + function createAndMoveVideo() {
|
| + var v = document.implementation.createHTMLDocument().createElement('video');
|
| + v.src = findMediaFile('video', 'content/test');
|
| + document.body.appendChild(v);
|
| + return v;
|
| + }
|
| +
|
| + test(function() {
|
| + assert_true(window.internals != null, 'This test only works with internals exposed present');
|
| + }, 'internals are exposed');
|
| +
|
| + async_test(function(t) {
|
| + window.internals.settings.setMediaPlaybackRequiresUserGesture(false);
|
| + var v = createAndMoveVideo();
|
| + assert_true(v.paused, 'Video should be paused before calling play()');
|
| +
|
| + v.play().then(
|
| + t.step_func_done(),
|
| + t.step_func_done(function() {
|
| + assert_unreached('Video should autoplay when gesture not required');
|
| + }));
|
| + }, 'Test that video should autoplay without gesture requirement');
|
| +
|
| + async_test(function(t) {
|
| + window.internals.settings.setMediaPlaybackRequiresUserGesture(true);
|
| + var v = createAndMoveVideo();
|
| + assert_true(v.paused, 'Video should be paused before calling play()');
|
| +
|
| + v.play().then(
|
| + t.step_func_done(function() {
|
| + assert_unreached('Video should not autoplay when gesture required');
|
| + }),
|
| + t.step_func_done());
|
| + }, 'Test that video should not autoplay when gesture required');
|
| +</script>
|
| +</body>
|
|
|