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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-display.html

Issue 2269883002: Refactor textTractDisplayElement utility function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
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 23 matching lines...) Expand all
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); 42 assert_equals(track.regions.length, 1);
43 43
44 region = textTrackDisplayElement(video, 'region'); 44 region = textTrackRegionElement(video);
45 var container = textTrackDisplayElement(video, 'region-container'); 45 var container = textTrackRegionContainerElement(video);
46 46
47 video.onseeked = this.step_func(function() { 47 video.onseeked = this.step_func(function() {
48 var totalVisibleLines = 0; 48 var totalVisibleLines = 0;
49 49
50 for (var i = 0; i < container.children.length; ++i) { 50 for (var i = 0; i < container.children.length; ++i) {
51 var cue = container.children[i]; 51 var cue = container.children[i];
52 totalVisibleLines += countVisibleLines(cue);; 52 totalVisibleLines += countVisibleLines(cue);;
53 } 53 }
54 54
55 assert_less_than_equal(totalVisibleLines, track.regions[0].heigh t); 55 assert_less_than_equal(totalVisibleLines, track.regions[0].heigh t);
56 56
57 if (seekTimeIndex == seekTimes.length) 57 if (seekTimeIndex == seekTimes.length)
58 this.done(); 58 this.done();
59 else 59 else
60 video.currentTime = seekTimes[seekTimeIndex++]; 60 video.currentTime = seekTimes[seekTimeIndex++];
61 }); 61 });
62 video.currentTime = seekTimes[seekTimeIndex++]; 62 video.currentTime = seekTimes[seekTimeIndex++];
63 }); 63 });
64 }); 64 });
65 testTrack.src = '../captions-webvtt/captions-regions.vtt'; 65 testTrack.src = '../captions-webvtt/captions-regions.vtt';
66 testTrack.kind = 'captions'; 66 testTrack.kind = 'captions';
67 testTrack.default = true; 67 testTrack.default = true;
68 video.appendChild(testTrack); 68 video.appendChild(testTrack);
69 }); 69 });
70 </script> 70 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698