OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Tests default rendering for TextTrackCues that belong to a VTTRegion.</ti
tle> | 2 <title>Tests default rendering for TextTrackCues that belong to a VTTRegion.</ti
tle> |
3 <script src="../../media-controls.js"></script> | 3 <script src="../../media-controls.js"></script> |
4 <script src="../../media-file.js"></script> | 4 <script src="../../media-file.js"></script> |
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 <video controls></video> | 7 <video controls></video> |
8 <script> | 8 <script> |
9 var region; | 9 var region; |
10 var seekTimes = [0.2, 0.5, 1.0, 2.3, 3.0]; | 10 var seekTimes = [0.2, 0.5, 1.0, 2.3, 3.0]; |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 async_test(function() { | 34 async_test(function() { |
35 var video = document.querySelector('video'); | 35 var video = document.querySelector('video'); |
36 video.src = findMediaFile('video', '../../content/test'); | 36 video.src = findMediaFile('video', '../../content/test'); |
37 var testTrack = document.createElement('track'); | 37 var testTrack = document.createElement('track'); |
38 testTrack.onload = this.step_func(function() { | 38 testTrack.onload = this.step_func(function() { |
39 video.oncanplaythrough = this.step_func(function() { | 39 video.oncanplaythrough = this.step_func(function() { |
40 track = video.textTracks[0]; | 40 track = video.textTracks[0]; |
41 | 41 |
42 assert_equals(track.regions.length, 1); | |
43 | |
44 region = textTrackRegionElement(video); | 42 region = textTrackRegionElement(video); |
45 var container = textTrackRegionContainerElement(video); | 43 var container = textTrackRegionContainerElement(video); |
46 | 44 |
47 video.onseeked = this.step_func(function() { | 45 video.onseeked = this.step_func(function() { |
48 var totalVisibleLines = 0; | 46 var totalVisibleLines = 0; |
49 | 47 |
50 for (var i = 0; i < container.children.length; ++i) { | 48 for (var i = 0; i < container.children.length; ++i) { |
51 var cue = container.children[i]; | 49 var cue = container.children[i]; |
52 totalVisibleLines += countVisibleLines(cue); | 50 totalVisibleLines += countVisibleLines(cue); |
53 } | 51 } |
54 | 52 |
55 assert_less_than_equal(totalVisibleLines, track.regions[0].lines
); | 53 assert_less_than_equal(totalVisibleLines, 2); |
56 | 54 |
57 if (seekTimeIndex == seekTimes.length) | 55 if (seekTimeIndex == seekTimes.length) |
58 this.done(); | 56 this.done(); |
59 else | 57 else |
60 video.currentTime = seekTimes[seekTimeIndex++]; | 58 video.currentTime = seekTimes[seekTimeIndex++]; |
61 }); | 59 }); |
62 video.currentTime = seekTimes[seekTimeIndex++]; | 60 video.currentTime = seekTimes[seekTimeIndex++]; |
63 }); | 61 }); |
64 }); | 62 }); |
65 testTrack.src = '../captions-webvtt/captions-regions.vtt'; | 63 testTrack.src = '../captions-webvtt/captions-regions.vtt'; |
66 testTrack.kind = 'captions'; | 64 testTrack.kind = 'captions'; |
67 testTrack.default = true; | 65 testTrack.default = true; |
68 video.appendChild(testTrack); | 66 video.appendChild(testTrack); |
69 }); | 67 }); |
70 </script> | 68 </script> |
OLD | NEW |