Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE HTML> | |
| 2 <html> | |
| 3 <body> | |
| 4 <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.
| |
| 5 <div id="log"></div> | |
| 6 <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.
| |
| 7 <script src="../resources/testharness.js"></script> | |
| 8 <script src="../resources/testharnessreport.js"></script> | |
| 9 <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.
| |
| 10 <script> | |
| 11 var test = async_test("srcObject test"); | |
| 12 var video = document.getElementById("testVideo"); | |
| 13 | |
| 14 function startTest() | |
| 15 { | |
| 16 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.
| |
| 17 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.
| |
| 18 test.step(_ => assert_equals(video.srcObject, null)); | |
| 19 test.step(_ => assert_equals(video.currentSrc, "")); | |
| 20 navigator.webkitGetUserMedia( | |
| 21 {video:true}, | |
| 22 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
| |
| 23 _ => 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.
| |
| 24 } | |
| 25 | |
| 26 function playingSrcObject() | |
| 27 { | |
| 28 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.
| |
| 29 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
| |
| 30 test.step(() => assert_not_equals(video.srcObject, null)); | |
| 31 test.step(() => assert_class_string(video.srcObject, "MediaStream")) ; | |
| 32 test.step(() => assert_equals(video.currentSrc, "")); | |
| 33 video.srcObject=null; | |
|
philipj_slow
2016/04/06 11:58:42
Needs more whitespace.
Guido Urdaneta
2016/04/06 16:34:54
Done.
| |
| 34 } | |
| 35 | |
| 36 function playingNothing() | |
| 37 { | |
| 38 test.step(() => assert_equals(video.srcObject, null)); | |
| 39 test.step(() => assert_equals(video.currentSrc, "")); | |
| 40 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.
| |
| 41 } | |
| 42 | |
| 43 test.step(startTest); | |
| 44 </script> | |
| 45 </body> | |
| 46 </html> | |
| OLD | NEW |