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> | 10 <div id="log"></div> |
11 <script> | 11 <script> |
12 async_test(function(t) | 12 async_test(function(t) |
13 { | 13 { |
14 var e = document.createElement('video'); | 14 var e = document.createElement('video'); |
15 // add to body to prevent GC pending http://crbug.com/400659 | |
16 document.body.appendChild(e); | |
17 | 15 |
18 assert_equals(e.audioTracks.length, 0); | 16 assert_equals(e.audioTracks.length, 0); |
19 assert_equals(e.audioTracks.getTrackById(''), null); | 17 assert_equals(e.audioTracks.getTrackById(''), null); |
20 | 18 |
21 assert_equals(e.videoTracks.length, 0); | 19 assert_equals(e.videoTracks.length, 0); |
22 assert_equals(e.videoTracks.getTrackById(''), null); | 20 assert_equals(e.videoTracks.getTrackById(''), null); |
23 | 21 |
24 e.src = findMediaFile('video', '../content/test'); | 22 e.src = findMediaFile('video', '../content/test'); |
25 | 23 |
26 e.addEventListener('loadedmetadata', t.step_func(function() | 24 e.addEventListener('loadedmetadata', t.step_func(function() |
27 { | 25 { |
28 assert_equals(e.audioTracks.length, 1); | 26 assert_equals(e.audioTracks.length, 1); |
29 assert_equals(e.audioTracks.getTrackById(e.audioTracks[0].id
), e.audioTracks[0]); | 27 assert_equals(e.audioTracks.getTrackById(e.audioTracks[0].id
), e.audioTracks[0]); |
30 assert_equals(e.audioTracks.getTrackById('fake-id'), null); | 28 assert_equals(e.audioTracks.getTrackById('fake-id'), null); |
31 | 29 |
32 assert_equals(e.videoTracks.length, 1); | 30 assert_equals(e.videoTracks.length, 1); |
33 assert_equals(e.videoTracks.getTrackById(e.videoTracks[0].id
), e.videoTracks[0]); | 31 assert_equals(e.videoTracks.getTrackById(e.videoTracks[0].id
), e.videoTracks[0]); |
34 assert_equals(e.videoTracks.getTrackById('fake-id'), null); | 32 assert_equals(e.videoTracks.getTrackById('fake-id'), null); |
35 | 33 |
36 t.done(); | 34 t.done(); |
37 })); | 35 })); |
38 }); | 36 }); |
39 </script> | 37 </script> |
40 </body> | 38 </body> |
41 </html> | 39 </html> |
OLD | NEW |