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

Side by Side Diff: LayoutTests/media/avtrack/addtrack.html

Issue 284513003: Implement AudioTrack, AudioTrackList, VideoTrack, and VideoTrackList (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: nits Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/media/avtrack/audio-track-enabled.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <title>AudioTrackList &amp; VideoTrackList addtrack event</title>
5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script>
7 <script src="../media-file.js"></script>
8 </head>
9 <body>
10 <div id="log"></div>
11 <script>
12 function addtrack_test(tagName, src, label)
13 {
14 function onTrackListEvent(actualEventList, e)
15 {
16 actualEventList.push(e.type);
17
18 if (e.type == "addtrack") {
19 assert_equals(e.track, e.target[0], "Track property matc hes first track in list.");
20 }
21 }
22
23 function setupTrackListHandlers(t, trackList, actualEventList)
24 {
25 trackList.addEventListener("addtrack", t.step_func(onTrackLi stEvent.bind(this, actualEventList)));
26 trackList.addEventListener("change", t.step_func(onTrackList Event.bind(this, actualEventList)));
27 trackList.addEventListener("removetrack", t.step_func(onTrac kListEvent.bind(this, actualEventList)));
28 }
29
30 async_test(function(t)
31 {
32 var e = document.createElement(tagName);
33 e.src = src;
34
35 var expectedEvents = ["addtrack"];
36 var actualAudioEvents = [];
37 var actualVideoEvents = [];
38 setupTrackListHandlers(t, e.audioTracks, actualAudioEvents, "audioTracks events");
39 setupTrackListHandlers(t, e.videoTracks, actualVideoEvents, "videoTracks events");
40
41 e.load();
42
43 e.addEventListener("loadedmetadata", t.step_func(function()
44 {
45 assert_array_equals(actualAudioEvents, expectedEvents);
46
47 if (e.videoTracks.length > 0) {
48 assert_equals(label, "audio-video");
49 assert_array_equals(actualVideoEvents, expectedEvent s);
50 } else {
51 assert_equals(label, "audio-only");
52 assert_equals(actualVideoEvents.length, 0);
53 }
54
55 t.done();
56 }));
57 }, tagName + " : " + label);
58 }
59
60 addtrack_test("audio", findMediaFile("audio", "../content/test"), "a udio-only");
61 addtrack_test("audio", findMediaFile("video", "../content/test"), "a udio-video");
62 addtrack_test("video", findMediaFile("audio", "../content/test"), "a udio-only");
63 addtrack_test("video", findMediaFile("video", "../content/test"), "a udio-video");
64 </script>
65 </body>
66 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/media/avtrack/audio-track-enabled.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698