Chromium Code Reviews| 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..1f6fb4211c9725e7eeece3f69c36d5818c3a686a 100644 |
| --- a/third_party/WebKit/LayoutTests/media/autoplay-muted.html |
| +++ b/third_party/WebKit/LayoutTests/media/autoplay-muted.html |
| @@ -3,15 +3,25 @@ |
| <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) |
| @@ -22,15 +32,44 @@ |
| 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"); |
| + eventWatcher.wait_for(expectedEvents).then( |
| + t.step_func_done(function() |
| + { |
|
mlamouri (slow - plz ping)
2016/06/09 17:43:16
style: { at end of previous line (here and other p
|
| + 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() |
| + { |
| + document.onclick = t.step_func_done(function() |
|
mlamouri (slow - plz ping)
2016/06/09 17:43:16
can you move this outside of the play() handler? j
|
| + { |
| + e.muted = false; |
| + assert_false(e.paused, |
| + "The video should not be paused."); |
| + }); |
| + |
| + eventSender.mouseDown(); |
| + eventSender.mouseUp(); |
| + })); |
| + }, "Test that unmuting autoplayed video with gesture doesn't pause it."); |
| </script> |