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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-dom-layout.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: Address more comments 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 default DOM layout structure for a VTTRegion.</title>
3 <head> 3 <script src="../../media-controls.js"></script>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 4 <script src="../../media-file.js"></script>
5 <script src="../../../resources/testharness.js"></script>
6 <script src="../../../resources/testharnessreport.js"></script>
7 <script>
8 async_test(function() {
9 var video = document.createElement('video');
10 video.src = findMediaFile('video', '../../content/test');
11 var testTrack = document.createElement('track');
12 testTrack.onload = this.step_func(function() {
13 video.oncanplaythrough = this.step_func_done(function() {
14 assert_equals(testTrack.track.regions.length, 1);
5 15
6 <script src=../../media-controls.js></script> 16 var region = textTrackDisplayElement(video, 'region');
7 <script src=../../media-file.js></script> 17 var container = textTrackDisplayElement(video, 'region-container');
8 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956
9 (Please avoid writing new tests using video-test.js) -->
10 <script src=../../video-test.js></script>
11 <script>
12 var testTrack;
13 var region;
14 var container;
15 18
16 function testRegionsDisplay() 19 assert_equals(region.children.length, 1);
17 { 20 assert_equals(region.children[0], container);
18 testTrack = video.textTracks[0]; 21 assert_equals(internals.shadowPseudoId(region), '-webkit-media-text- track-region');
19 22 assert_equals(internals.shadowPseudoId(container), '-webkit-media-te xt-track-region-container');
20 consoleWrite("** The text track has only one region **"); 23 });
21 testExpected("testTrack.regions.length", 1); 24 });
22 25 testTrack.src = '../captions-webvtt/captions-regions.vtt';
23 try { 26 testTrack.kind = 'captions';
24 region = textTrackDisplayElement(video, 'region'); 27 testTrack.default = true;
25 container = textTrackDisplayElement(video, 'region-container'); 28 video.appendChild(testTrack);
26 } catch(e) { 29 });
27 consoleWrite(e); 30 </script>
28 }
29
30 consoleWrite("<br>** Inspecting the default DOM layout used for regi ons display **");
31
32 consoleWrite("<br>** Only one region should be displayed **");
33 testExpected("region.children.length", 1);
34
35 consoleWrite("<br>** The child of the region should be the container **");
36 testExpected("region.children[0] == container", true);
37
38 consoleWrite("<br>** Default pseudo IDs should be set properly");
39 testExpected("internals.shadowPseudoId(region)", "-webkit-media-text -track-region");
40 testExpected("internals.shadowPseudoId(container)", "-webkit-media-t ext-track-region-container");
41
42 endTest();
43 }
44
45 function startTest()
46 {
47 if (!window.VTTRegion) {
48 failTest();
49 return;
50 }
51
52 findMediaElement();
53
54 video.src = findMediaFile('video', '../../content/test');
55 waitForEvent('canplaythrough', testRegionsDisplay);
56 }
57
58 </script>
59 </head>
60 <body>
61 <p>Tests default DOM layout structure for a VTTRegion.</p>
62 <video controls>
63 <track src="../captions-webvtt/captions-regions.vtt" kind="captions" default onload="startTest()">
64 </video>
65 </body>
66 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698