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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/track-webvtt-tc016-align-positioning.html

Issue 2012833002: Convert track-webvtt-tc[016-018] tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <title>Tests cue text position and alignment from settings.</title>
3 <head> 3 <script src="track-helpers.js"></script>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
6 <video>
7 <track src="captions-webvtt/tc016-align-positioning.vtt">
8 <track src="captions-webvtt/tc016-align-positioning-bad.vtt">
9 </video>
10 <script>
11 async_test(function(t) {
12 var video = document.querySelector("video");
5 13
6 <script src=../media-file.js></script> 14 var trackElements = document.querySelectorAll("track");
7 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 15 assert_equals(trackElements.length, video.textTracks.length);
8 (Please avoid writing new tests using video-test.js) --> 16 for (var i = 0; i < trackElements.length; i++)
9 <script src=../video-test.js></script> 17 trackElements[i].onload = t.step_func(trackLoaded);
10 <script>
11 18
12 var numberOfTrackTests = 2; 19 enableAllTextTracks(video.textTracks);
13 20
14 function trackLoaded() 21 var numberOfTracksLoaded = 0;
15 { 22 function trackLoaded() {
16 numberOfTracksLoaded++; 23 numberOfTracksLoaded++;
17 if (numberOfTracksLoaded == numberOfTrackTests) { 24 if (numberOfTracksLoaded != 2)
18 testTrack(0); 25 return;
19 testTrackError(1);
20 }
21 }
22 26
23 function testTrack(i) 27 testTrack(0);
24 { 28 testTrackError(1);
25 findMediaElement(); 29 t.done();
26 var expected = 30 }
27 {
28 length : 3,
29 tests:
30 [
31 {
32 property : "position",
33 values : [10, 20, 80],
34 },
35 {
36 property : "align",
37 values : ["start", "middle", "end"],
38 },
39 ],
40 };
41 testCues(i, expected);
42 31
43 allTestsEnded(); 32 function testTrack(index) {
44 } 33 var expected = [
34 { position : 10, align : "start" },
35 { position : 20, align : "middle" },
36 { position : 80, align : "end" }
37 ];
38 var properties = [ "position", "align" ];
45 39
46 function testTrackError(i) 40 assert_cues_match(video.textTracks[index].cues, expected, properties);
47 { 41 }
48 findMediaElement();
49 var expected =
50 {
51 length : 3,
52 tests:
53 [
54 {
55 property : "position",
56 values : [10, "auto", "auto"],
57 },
58 {
59 property : "align",
60 values : ["middle", "middle", "middle"],
61 },
62 ],
63 };
64 testCues(i, expected);
65 42
66 allTestsEnded(); 43 function testTrackError(index) {
67 } 44 var expected = [
68 </script> 45 { position : 10, align : "middle" },
69 </head> 46 { position : "auto", align : "middle" },
70 <body onload="enableAllTextTracks()"> 47 { position : "auto", align : "middle" }
71 <p>Tests cue text position and alignment from settings.</p> 48 ];
72 <video> 49 var properties = [ "position", "align" ];
73 <track src="captions-webvtt/tc016-align-positioning.vtt" onload="tra ckLoaded()"> 50
74 <track src="captions-webvtt/tc016-align-positioning-bad.vtt" onload= "trackLoaded()"> 51 assert_cues_match(video.textTracks[index].cues, expected, properties);
75 </video> 52 }
76 </body> 53 });
77 </html> 54 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698