OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Tests rendering text track cue line with padding set.</title> |
3 <head> | 3 <script src="../media-file.js"></script> |
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 4 <script src="../media-controls.js"></script> |
| 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <style> |
| 8 video::-webkit-media-text-track-display { |
| 9 padding: 15px; |
| 10 } |
| 11 </style> |
| 12 <video> |
| 13 <track src="captions-webvtt/captions-fast.vtt" kind="captions" default> |
| 14 </video> |
| 15 <script> |
| 16 async_test(function(t) { |
| 17 var video = document.querySelector("video"); |
| 18 video.src = findMediaFile("video", "../content/test"); |
5 | 19 |
6 <style type="text/css"> | 20 video.onseeked = t.step_func_done(function() { |
7 video::-webkit-media-text-track-display { | 21 var cueContainerElement = textTrackDisplayElement(video); |
8 padding: 15px; | 22 var cueDisplayElement = textTrackDisplayElement(video, "display", 0); |
9 } | |
10 </style> | |
11 | 23 |
12 <script src=../media-file.js></script> | 24 var cueDisplayBottomPoint = cueDisplayElement.offsetTop + cueDisplayElem
ent.offsetHeight; |
13 <script src=../media-controls.js></script> | 25 var cueContainerBottomPoint = cueContainerElement.offsetTop + cueContain
erElement.offsetHeight; |
14 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | |
15 (Please avoid writing new tests using video-test.js) --> | |
16 <script src=../video-test.js></script> | |
17 | 26 |
18 <script> | 27 // Cue should be displayed entirely within the container. |
19 var cueContainerBottomPoint; | 28 assert_true(cueDisplayBottomPoint <= cueContainerBottomPoint); |
20 var cueDisplayBottomPoint; | 29 }); |
21 | 30 |
22 function startTest() | 31 video.currentTime = 0.25; |
23 { | 32 }); |
24 if (!window.internals) { | 33 </script> |
25 consoleWrite("<br><b>** This test only works in DRT! **<" + "/b>
"); | |
26 return; | |
27 } | |
28 | |
29 var cueContainerElement = textTrackDisplayElement(video); | |
30 var cueDisplayElement = textTrackDisplayElement(video, 'display', 0)
; | |
31 | |
32 cueDisplayBottomPoint = cueDisplayElement.offsetTop + cueDisplayElem
ent.offsetHeight; | |
33 cueContainerBottomPoint = cueContainerElement.offsetTop + cueContain
erElement.offsetHeight; | |
34 | |
35 consoleWrite("<br>** Cue should be displayed entirely within the con
tainer. **"); | |
36 testExpected("cueDisplayBottomPoint <= cueContainerBottomPoint", tru
e); | |
37 endTest(); | |
38 } | |
39 | |
40 function loaded() | |
41 { | |
42 consoleWrite("Rendering text track cue line with padding set.<br>"); | |
43 findMediaElement(); | |
44 | |
45 testTrack = document.querySelector('track'); | |
46 video.src = findMediaFile('video', '../content/test'); | |
47 | |
48 waitForEvent('seeked', startTest); | |
49 waitForEvent('canplaythrough', function() { | |
50 video.currentTime = .25; | |
51 }); | |
52 } | |
53 | |
54 </script> | |
55 </head> | |
56 <body onload="loaded()"> | |
57 <video controls> | |
58 <track src="captions-webvtt/captions-fast.vtt" kind="captions" defau
lt> | |
59 </video> | |
60 </body> | |
61 </html> | |
OLD | NEW |