| Index: third_party/WebKit/LayoutTests/media/autoplay-muted.html
|
| diff --git a/third_party/WebKit/LayoutTests/media/autoplay-muted.html b/third_party/WebKit/LayoutTests/media/autoplay-muted.html
|
| index 3ac13cbffad04950725f67645c0bd43cd19010e6..bd83ef15f90ecaae5e2f62d522701319693ebc67 100644
|
| --- a/third_party/WebKit/LayoutTests/media/autoplay-muted.html
|
| +++ b/third_party/WebKit/LayoutTests/media/autoplay-muted.html
|
| @@ -3,34 +3,61 @@
|
| <script src="../resources/testharness.js"></script>
|
| <script src="../resources/testharnessreport.js"></script>
|
| <script src="media-file.js"></script>
|
| +<script src="media-controls.js"></script>
|
| <script>
|
| + test(function() {
|
| + assert_true(!!window.internals
|
| + && !!window.internals.settings
|
| + && !!window.internals.runtimeFlags
|
| + && !!window.eventSender,
|
| + "This test only works when run as a layout test!");
|
| + }, "Prerequisites to running the rest of the tests");
|
| +
|
| window.internals.settings.setMediaPlaybackRequiresUserGesture(true);
|
| window.internals.runtimeFlags.autoplayMutedVideosEnabled = true;
|
|
|
| function createMutedVideoElement() {
|
| - var e = document.createElement('video');
|
| - e.src = findMediaFile('video', 'content/test');
|
| - e.muted = true;
|
| - return e;
|
| + var e = document.createElement('video');
|
| + e.src = findMediaFile('video', 'content/test');
|
| + e.muted = true;
|
| + return e;
|
| }
|
|
|
| - async_test(function(t)
|
| - {
|
| + async_test(function(t) {
|
| var e = createMutedVideoElement();
|
| e.autoplay = true;
|
|
|
| - var expectedEvents = [
|
| - 'canplay', 'play', 'playing'];
|
| + var expectedEvents = [ 'canplay', 'play', 'playing'];
|
| var eventWatcher = new EventWatcher(t, e, expectedEvents);
|
| - eventWatcher.wait_for(expectedEvents)
|
| - .then(t.step_func_done(function()
|
| - {
|
| - assert_false(e.paused);
|
| - }));
|
| - }, "muted-autoplay");
|
| -
|
| - promise_test(function()
|
| - {
|
| + eventWatcher.wait_for(expectedEvents).then(
|
| + t.step_func_done(function() {
|
| + assert_false(e.paused);
|
| + }));
|
| + }, "Test that a muted video with an autoplay attribute autoplays.");
|
| +
|
| + promise_test(function() {
|
| return createMutedVideoElement().play();
|
| - }, "muted-playjs");
|
| + }, "Test that play() on a muted video succeeds without gesture.");
|
| +
|
| + promise_test(function(t) {
|
| + var e = createMutedVideoElement();
|
| + return e.play().then(t.step_func_done(function() {
|
| + e.muted = false;
|
| + assert_true(e.paused, "The video should be paused.");
|
| + }));
|
| + }, "Test that unmuting an autoplayed video without gesture pauses.");
|
| +
|
| + async_test(function(t) {
|
| + var e = createMutedVideoElement();
|
| +
|
| + e.play().then(t.step_func(function() {
|
| + eventSender.mouseDown();
|
| + eventSender.mouseUp();
|
| + }));
|
| +
|
| + document.onclick = t.step_func_done(function() {
|
| + e.muted = false;
|
| + assert_false(e.paused, "The video should not be paused.");
|
| + });
|
| + }, "Test that unmuting autoplayed video with gesture doesn't pause it.");
|
| </script>
|
|
|