<!DOCTYPE HTML>
<title>Test assignment of a MediaStream via the srcObject attribute.</title>
<video autoplay></video>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
async_test(test => {
var video = document.querySelector("video")
assert_idl_attribute(video, "srcObject");
assert_equals(video.srcObject, null);
assert_equals(video.currentSrc, "");
navigator.webkitGetUserMedia(
{video:true},
test.step_func(stream => {
video.addEventListener("playing", test.step_func(playingSrcObject));
video.srcObject = stream;
}),
test.unreached_func("Did not get mediastream"));
function playingSrcObject()
{
video.addEventListener("emptied", test.step_func_done(_ => {
assert_equals(video.srcObject, null);
assert_equals(video.currentSrc, "");
}));
assert_not_equals(video.srcObject, null);
assert_class_string(video.srcObject, "MediaStream");
assert_equals(video.currentSrc, "");
video.srcObject = null;
}
})
</script>