Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/video-srcobject-mediastream.html |
| diff --git a/third_party/WebKit/LayoutTests/media/video-srcobject-mediastream.html b/third_party/WebKit/LayoutTests/media/video-srcobject-mediastream.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9a0447cf0052810683542e1391f2e49296381e5d |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/media/video-srcobject-mediastream.html |
| @@ -0,0 +1,46 @@ |
| +<!DOCTYPE HTML> |
| +<html> |
| +<body> |
| + <video id="testVideo" autoplay="autoplay"></video> |
|
philipj_slow
2016/04/06 11:58:42
Nit: The autoplay attribute doesn't need any speci
Guido Urdaneta
2016/04/06 16:34:54
Done.
|
| + <div id="log"></div> |
| + <p>Test assigment of a mediastream via the srcObject attribute.</p> |
|
philipj_slow
2016/04/06 11:58:42
Can you put this inside <title> at the top? This w
Guido Urdaneta
2016/04/06 16:34:54
Done.
|
| + <script src="../resources/testharness.js"></script> |
| + <script src="../resources/testharnessreport.js"></script> |
| + <script src="./w3c-media-utils.js"></script> |
|
philipj_slow
2016/04/06 11:58:41
Doesn't look like you're using anything from w3c-m
Guido Urdaneta
2016/04/06 16:34:54
Done.
|
| + <script> |
| + var test = async_test("srcObject test"); |
| + var video = document.getElementById("testVideo"); |
| + |
| + function startTest() |
| + { |
| + test.step(() => assert_idl_attribute(video, "srcObject")); |
|
philipj_slow
2016/04/06 11:58:42
You shouldn't need to wrap any individual steps li
Guido Urdaneta
2016/04/06 16:34:54
Done.
|
| + video.addEventListener("playing", playingSrcObject); |
|
philipj_slow
2016/04/06 11:58:41
Here you'll need test.step_func(playingSrcObject).
Guido Urdaneta
2016/04/06 16:34:54
Done.
|
| + test.step(_ => assert_equals(video.srcObject, null)); |
| + test.step(_ => assert_equals(video.currentSrc, "")); |
| + navigator.webkitGetUserMedia( |
| + {video:true}, |
| + stream => video.srcObject = stream, |
|
philipj_slow
2016/04/06 11:58:42
The sequence of events could be a bit clearer if y
Guido Urdaneta
2016/04/06 16:34:54
Done, but kept the autoplay. With an explicit call
philipj_slow
2016/04/07 15:38:11
Do you get a rejected promise even if you call pla
|
| + _ => test.step(() => assert_unreached("Did not get mediastream"))); |
|
philipj_slow
2016/04/06 11:58:41
This can be test.unreached_func("Did not get Media
Guido Urdaneta
2016/04/06 16:34:54
Done.
|
| + } |
| + |
| + function playingSrcObject() |
| + { |
| + video.removeEventListener("playing", playingSrcObject) |
|
philipj_slow
2016/04/06 11:58:42
Is this needed? If it is, then using the onplaying
Guido Urdaneta
2016/04/06 16:34:54
Done. Not needed.
|
| + video.addEventListener("emptied", playingNothing) |
|
philipj_slow
2016/04/06 11:58:41
This is an oddly named callback. If you don't enjo
Guido Urdaneta
2016/04/06 16:34:54
Done. What would have been a good name? :)
philipj_slow
2016/04/07 15:38:11
Maybe "emptied"? Just "playing" for the current fu
|
| + test.step(() => assert_not_equals(video.srcObject, null)); |
| + test.step(() => assert_class_string(video.srcObject, "MediaStream")); |
| + test.step(() => assert_equals(video.currentSrc, "")); |
| + video.srcObject=null; |
|
philipj_slow
2016/04/06 11:58:42
Needs more whitespace.
Guido Urdaneta
2016/04/06 16:34:54
Done.
|
| + } |
| + |
| + function playingNothing() |
| + { |
| + test.step(() => assert_equals(video.srcObject, null)); |
| + test.step(() => assert_equals(video.currentSrc, "")); |
| + test.done(); |
|
philipj_slow
2016/04/06 11:58:42
When this is wrapped instead, you can use test.ste
Guido Urdaneta
2016/04/06 16:34:54
Done.
|
| + } |
| + |
| + test.step(startTest); |
| + </script> |
| + </body> |
| +</html> |