blob: 94b3e9013cfa31ef481adef6801c25de17cd93f3 [file] [log] [blame]
<!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>
test(function() {
assert_true(!!window.internals && !!internals.settings,
"This test only works when run as a layout test!");
}, "Prerequisites to running the rest of the tests");
internals.settings.setAutoplayPolicy('user-gesture-required');
async_test(function(t) {
var v = document.createElement('video');
v.srcObject = (new AudioContext()).createMediaStreamDestination().stream;
setTimeout(t.step_func(function() {
v.srcObject = null;
v.src = 'content/test.ogv';
v.play()
.then(t.unreached_func('The video must not play without user gesture.'))
.catch(t.step_func_done(function() {
assert_true(v.paused);
}));
}), 0);
}, 'Test that switching from MediaStream to src= does not autoplay.');
</script>