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

Side by Side Diff: LayoutTests/media/track/regions-webvtt/text-track-region-list.html

Issue 55653003: Rename TextTrackRegion/TextTrackRegionList to VTTRegion/VTTRegionList (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update test expectations Created 7 years, 1 month 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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
6 <script src=../../media-file.js></script>
7 <script src=../../video-test.js></script>
8 <script>
9 var testTrack;
10 var region;
11 var regions;
12 var updatedRegion;
13
14 function startTest()
15 {
16 testTrack = document.getElementsByTagName('track')[0];
17
18 consoleWrite("<br>** Implicit mode disabled and the regions attribut e is null **");
19 testExpected("testTrack.track.mode", "disabled");
20 testExpected("testTrack.track.regions", null);
21
22 testTrack.track.mode = "hidden";
23 regions = testTrack.track.regions;
24
25 consoleWrite("<br>** The regions attribute should be an empty TextTr ackRegionList **");
26 testExpected("regions != null", true);
27 testExpected("regions.length", 0);
28
29 region = new TextTrackRegion();
30 region.id = "TestId";
31
32 consoleWrite("<br>** The default value of the track attribute of the region is null**");
33 testExpected("region.track", null);
34
35 testTrack.track.addRegion(region);
36
37 consoleWrite("<br>** The addRegion() method properly updates the Tex tTrackRegionList object **");
38 testExpected("regions.length", 1);
39 testExpected("regions[0] == region", true);
40 testExpected("regions[0].track == testTrack.track", true);
41
42 consoleWrite("<br>** The track attribute should correctly reflect th e track to which the region was added to**");
43 testExpected("region.track == testTrack.track", true);
44
45 updatedRegion = new TextTrackRegion();
46 updatedRegion.id = region.id;
47 updatedRegion.viewportAnchorX = 59;
48 updatedRegion.viewportAnchorY = 68;
49 updatedRegion.regionAnchorX = 20;
50 updatedRegion.regionAnchorY = 30;
51 updatedRegion.height = 5;
52 updatedRegion.width = 87;
53 updatedRegion.scroll = "up";
54
55 consoleWrite("<br>** Adding a region with an existing id should upda te the existing region **");
56 testTrack.track.addRegion(updatedRegion);
57 testExpected("regions[0].viewportAnchorX", updatedRegion.viewportAnc horX);
58 testExpected("regions[0].viewportAnchorY", updatedRegion.viewportAnc horY);
59 testExpected("regions[0].regionAnchorX", updatedRegion.regionAnchorX );
60 testExpected("regions[0].regionAnchorY", updatedRegion.regionAnchorY );
61 testExpected("regions[0].height", updatedRegion.height);
62 testExpected("regions[0].width", updatedRegion.width);
63 testExpected("regions[0].scroll", updatedRegion.scroll);
64
65 testExpected("regions[0] != updatedRegion", true);
66
67 consoleWrite("<br>** Add the region back and check if removeRegion() removes it properly **");
68 testTrack.track.addRegion(region);
69 testExpected("regions.length", 1);
70 testTrack.track.removeRegion(region);
71 testExpected("regions.length", 0);
72
73 consoleWrite("<br>** In case the region is not found, NotFoundError should be thrown **");
74 try {
75 testTrack.track.removeRegion(region);
76 } catch(e) {
77 consoleWrite(e);
78 }
79
80 // FIXME(109818): Update test for multiple initial regions (after pa rsing is supported).
81
82 consoleWrite("");
83 endTest();
84 }
85
86 function startTestWithDelay()
87 {
88 setTimeout(startTest, 100);
89 }
90 </script>
91 </head>
92 <body onload="startTestWithDelay()">
93 <p>Tests TextTrackRegionList functionality: length, operator[], and getR egionById()</p>
94 <video>
95 <track id="testTrack" src="captions-webvtt/captions-fast.vtt">
96 </video>
97 </body>
98 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698