OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>AudioTrackList & VideoTrackList.getTrackById</title> | 4 <title>AudioTrackList & VideoTrackList.getTrackById</title> |
5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
7 <script src="../media-file.js"></script> | 7 <script src="../media-file.js"></script> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <div id="log"></div> | |
11 <script> | 10 <script> |
12 async_test(function(t) | 11 async_test(function(t) |
13 { | 12 { |
14 var e = document.createElement('video'); | 13 var video = document.createElement('video'); |
15 | 14 |
16 assert_equals(e.audioTracks.length, 0); | 15 assert_equals(video.audioTracks.length, 0); |
17 assert_equals(e.audioTracks.getTrackById(''), null); | 16 assert_equals(video.audioTracks.getTrackById(''), null); |
18 | 17 |
19 assert_equals(e.videoTracks.length, 0); | 18 assert_equals(video.videoTracks.length, 0); |
20 assert_equals(e.videoTracks.getTrackById(''), null); | 19 assert_equals(video.videoTracks.getTrackById(''), null); |
21 | 20 |
22 e.src = findMediaFile('video', '../content/test'); | 21 video.src = findMediaFile('video', '../content/test'); |
23 | 22 |
24 e.addEventListener('loadedmetadata', t.step_func(function() | 23 video.addEventListener('loadedmetadata', t.step_func_done(functi
on() |
25 { | 24 { |
26 assert_equals(e.audioTracks.length, 1); | 25 assert_equals(video.audioTracks.length, 1); |
27 assert_equals(e.audioTracks.getTrackById(e.audioTracks[0].id
), e.audioTracks[0]); | 26 assert_equals(video.audioTracks.getTrackById(video.audioTrac
ks[0].id), video.audioTracks[0]); |
28 assert_equals(e.audioTracks.getTrackById('fake-id'), null); | 27 assert_equals(video.audioTracks.getTrackById('fake-id'), nul
l); |
29 | 28 |
30 assert_equals(e.videoTracks.length, 1); | 29 assert_equals(video.videoTracks.length, 1); |
31 assert_equals(e.videoTracks.getTrackById(e.videoTracks[0].id
), e.videoTracks[0]); | 30 assert_equals(video.videoTracks.getTrackById(video.videoTrac
ks[0].id), video.videoTracks[0]); |
32 assert_equals(e.videoTracks.getTrackById('fake-id'), null); | 31 assert_equals(video.videoTracks.getTrackById('fake-id'), nul
l); |
33 | |
34 t.done(); | |
35 })); | 32 })); |
36 }); | 33 }); |
37 </script> | 34 </script> |
38 </body> | 35 </body> |
39 </html> | 36 </html> |
OLD | NEW |