Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: third_party/WebKit/LayoutTests/media/video-srcobject-mediastream-src-file.html

Issue 1815033003: Add srcObject attribute of type MediaStream to HTMLMediaElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix condition Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <html>
3 <body>
4 <video id="testVideo" autoplay="autoplay"></video>
5 <div id="log"></div>
philipj_slow 2016/04/06 11:58:41 You typically don't need to include this, it'll be
Guido Urdaneta 2016/04/06 16:34:54 Done.
6 <p>Test that setting the HTMLMediaElement.srcObject overrides setting the
7 src attribute and if the srcObject is set to null, media is reloaded from
8 the src attribute.</p>
9 <script src="../resources/testharness.js"></script>
10 <script src="../resources/testharnessreport.js"></script>
11 <script src="./w3c-media-utils.js"></script>
12 <script>
13 var test = async_test("srcObject test");
14 var video = document.getElementById("testVideo");
philipj_slow 2016/04/06 11:58:41 You can skip the id and just use document.querySel
Guido Urdaneta 2016/04/06 16:34:54 Done.
15 var trackevent = "playing";
philipj_slow 2016/04/06 11:58:41 Just inline "playing" everywhere?
Guido Urdaneta 2016/04/06 16:34:54 Done. Using onplaying instead.
16
17 function startTest()
18 {
19 test.step(() => assert_idl_attribute(video, "srcObject"));
20 video.addEventListener(trackevent, playingFileFromSrc)
21 video.src = getVideoURI("test");
philipj_slow 2016/04/06 11:58:41 It'd be more clear if you set src and srcObject at
Guido Urdaneta 2016/04/06 16:34:54 Done.
22 }
23
24 function playingFileFromSrc()
25 {
26 video.removeEventListener(trackevent, playingFileFromSrc);
27 video.addEventListener(trackevent, playingSrcObject);
28 test.step(_ => assert_equals(video.srcObject, null));
29 test.step(_ => assert_equals(video.currentSrc, video.src));
30 navigator.webkitGetUserMedia(
31 {video:true},
32 stream => video.srcObject = stream,
33 _ => test.step(() => assert_unreached("Did not get mediastream") ));
34 }
35
36 function playingSrcObject()
37 {
38 video.removeEventListener(trackevent, playingSrcObject)
39 video.addEventListener(trackevent, playingFileAfterSrcObjectRemoved)
40 test.step(() => assert_not_equals(video.srcObject, null));
41 test.step(() => assert_class_string(video.srcObject, "MediaStream")) ;
42 test.step(() => assert_equals(video.currentSrc, ""));
43 video.srcObject = null;
44 }
45
46 function playingFileAfterSrcObjectRemoved()
47 {
48 test.step(() => assert_equals(video.srcObject, null));
49 test.step(() => assert_equals(video.currentSrc, video.src));
50 test.done();
51 }
52
53 test.step(startTest);
54 </script>
55 </body>
56 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698