| Index: third_party/WebKit/LayoutTests/media/autoplay-from-mediastream-to-src.html
|
| diff --git a/third_party/WebKit/LayoutTests/media/autoplay-from-mediastream-to-src.html b/third_party/WebKit/LayoutTests/media/autoplay-from-mediastream-to-src.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6d939424b1b011d35799c62ae9fa835a62d47398
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/media/autoplay-from-mediastream-to-src.html
|
| @@ -0,0 +1,45 @@
|
| +<!DOCTYPE html>
|
| +<title>Test for autoplay of video once the media stream is set to null</title>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<script src="media-file.js"></script>
|
| +<script>
|
| + test(function() {
|
| + assert_true(!!window.internals && !!window.internals.settings,
|
| + "This test only works when run as a layout test!");
|
| + }, "Prerequisites to running the rest of the tests");
|
| +
|
| + window.internals.settings.setMediaPlaybackRequiresUserGesture(true);
|
| +
|
| + async_test(function(t) {
|
| + var v = document.createElement('video');
|
| + // getUserMedia works with autoplay video elements, play() is
|
| + // blocked.
|
| + v.autoplay = true;
|
| +
|
| + v.onplaying = function() {
|
| + assert_false(v.paused);
|
| +
|
| + v.onplaying = null;
|
| + v.srcObject = null;
|
| +
|
| + // Once the source has changed to anything but MediaStream, the
|
| + // video must not be able to play.
|
| + v.src = findMediaFile('video', 'content/test');
|
| + v.play()
|
| + .then(t.unreached_func('The video must not play without user gesture.'))
|
| + .catch(t.step_func_done(function() {
|
| + assert_true(v.paused);
|
| + }));
|
| + };
|
| +
|
| + navigator.webkitGetUserMedia(
|
| + { video : true },
|
| + t.step_func(function(s) {
|
| + v.srcObject = s;
|
| + }),
|
| + t.unreached_func('Can not get MediaStream object.'));
|
| + }, 'Test that switching from MediaStream to src= does not autoplay.');
|
| +
|
| +</script>
|
| +
|
|
|