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

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

Issue 1854553003: Convert webvtt regions tests from video-test.js to testharness.js based (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 proper parsing of various regions present in WebVTT header area.</t itle>
3 <head> 3 <script src="../../../resources/testharness.js"></script>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 4 <script src="../../../resources/testharnessreport.js"></script>
5 <script src="../../media-file.js"></script>
6 <script>
7 async_test(function(t) {
8 assert_not_equals(window.VTTRegion, null);
5 9
6 <script src=../../media-file.js></script> 10 var video = document.createElement('video');
7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 11 video.src = findMediaFile('video', '../../content/test');
8 (Please avoid writing new tests using video-test.js) --> 12 var testTrack = document.createElement('track');
9 <script src=../../video-test.js></script> 13 testTrack.onload = this.step_func(function() {
10 <script> 14 var track = testTrack.track;
11 var region; 15 assert_equals(track.regions.length, 5);
12 16
13 function startTest() 17 var region = track.regions[0];
14 { 18 assert_equals(region.id, 'region_without_settings');
15 if (!window.VTTRegion) {
16 failTest();
17 return;
18 }
19 19
20 findMediaElement(); 20 region = track.regions[1];
21 testExpected("video.textTracks[0].regions.length", 5); 21 assert_equals(region.id, 'region_with_all_settings');
22 assert_equals(region.width, 32);
23 assert_equals(region.height, 5);
24 assert_equals(region.regionAnchorX, 41);
25 assert_equals(region.regionAnchorY, 20);
26 assert_equals(region.viewportAnchorX, 31);
27 assert_equals(region.viewportAnchorY, 84);
28 assert_equals(region.scroll, 'up');
22 29
23 consoleWrite(""); 30 region = track.regions[2];
24 region = video.textTracks[0].regions[0]; 31 assert_equals(region.id, 'region_floating_point_anchor');
25 testExpected("region.id", "region_without_settings"); 32 assert_equals(Math.round(region.regionAnchorX * 1000), 41133);
33 assert_equals(Math.round(region.regionAnchorY * 1000), 20420);
34 assert_equals(Math.round(region.viewportAnchorX * 1000), 32330);
35 assert_equals(Math.round(region.viewportAnchorY * 1000), 32440);
26 36
27 consoleWrite(""); 37 region = track.regions[3];
28 region = video.textTracks[0].regions[1]; 38 assert_equals(region.id, 'not_unique_id');
29 testExpected("region.id", "region_with_all_settings"); 39 assert_equals(region.width, 67);
30 testExpected("region.width", 32);
31 testExpected("region.height", 5);
32 testExpected("region.regionAnchorX", 41);
33 testExpected("region.regionAnchorY", 20);
34 testExpected("region.viewportAnchorX", 31);
35 testExpected("region.viewportAnchorY", 84);
36 testExpected("region.scroll", "up");
37 40
38 consoleWrite(""); 41 region = track.regions[4];
39 region = video.textTracks[0].regions[2]; 42 assert_equals(region.id, "");
40 testExpected("region.id", "region_floating_point_anchor"); 43
41 testExpected("Math.round(region.regionAnchorX * 1000)", 41133); 44 this.done();
42 testExpected("Math.round(region.regionAnchorY * 1000)", 20420); 45 });
43 testExpected("Math.round(region.viewportAnchorX * 1000)", 32330); 46 testTrack.src= '../captions-webvtt/header-regions.vtt';
44 testExpected("Math.round(region.viewportAnchorY * 1000)", 32440); 47 testTrack.kind = 'captions';
45 48 testTrack.default = true;
46 consoleWrite(""); 49 video.appendChild(testTrack);
47 region = video.textTracks[0].regions[3]; 50 });
48 testExpected("region.id", "not_unique_id"); 51 </script>
49 testExpected("region.width", 67);
50
51 consoleWrite("");
52 region = video.textTracks[0].regions[4];
53 testExpected("region.id", "");
54
55 consoleWrite("");
56 endTest();
57 }
58
59 </script>
60 </head>
61 <body>
62 <p>Tests proper parsing of various regions present in WebVTT header area .</p>
63 <video controls>
64 <track src="../captions-webvtt/header-regions.vtt" kind="captions" d efault onload="startTest()">
65 </video>
66
67 </body>
68 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698