OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Test that the cue is not styled when video is in a shadow tree and style
is in a document.</title> |
3 <head> | |
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
5 <script src="../media-file.js"></script> | 3 <script src="../media-file.js"></script> |
6 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | |
7 (Please avoid writing new tests using video-test.js) --> | |
8 <script src="../video-test.js"></script> | |
9 <script src="../media-controls.js"></script> | 4 <script src="../media-controls.js"></script> |
| 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> |
10 <style> | 7 <style> |
11 video::cue(.red, .red2) { color:red } | 8 video::cue(.red, .red2) { color:red } |
12 video::cue(.green) { color:green } | 9 video::cue(.green) { color:green } |
13 </style> | 10 </style> |
| 11 <div id='host'> |
| 12 </div> |
14 <script> | 13 <script> |
15 var cueNode; | 14 async_test(function(t) { |
16 var seekedCount = 0; | |
17 var step = 0.4; | |
18 var initialTime = 0.6; | |
19 var endTime = 3.0 | |
20 | |
21 function seeked() | |
22 { | |
23 if (testEnded) | |
24 return; | |
25 | |
26 cueNode = textTrackDisplayElement(video, 'cue').firstElementChild; | |
27 testExpected("getComputedStyle(cueNode).color", "rgb(255, 0, 0)", "!="); | |
28 cueNode = cueNode.nextElementSibling; | |
29 testExpected("getComputedStyle(cueNode).color", "rgb(0, 128, 0)", "!="); | |
30 cueNode = cueNode.nextElementSibling; | |
31 testExpected("getComputedStyle(cueNode).color", "rgb(255, 0, 0)", "!="); | |
32 endTest(); | |
33 } | |
34 | |
35 function loaded() | |
36 { | |
37 consoleWrite("Test that the cue is not styled when video is in a shadow tree
and style is in a document."); | |
38 var host = document.getElementById('host'); | 15 var host = document.getElementById('host'); |
39 var shadowRoot = host.createShadowRoot(); | 16 var shadowRoot = host.createShadowRoot(); |
40 shadowRoot.innerHTML = '<video controls ><track src="captions-webvtt/styling
-lifetime.vtt" kind="captions" default></video>'; | 17 shadowRoot.innerHTML = '<video controls ><track src="captions-webvtt/styling
-lifetime.vtt" kind="captions" default></video>'; |
41 video = shadowRoot.querySelector('video'); | 18 var video = shadowRoot.querySelector('video'); |
42 video.src = findMediaFile('video', '../content/test'); | 19 video.src = findMediaFile('video', '../content/test'); |
43 video.id = "testvideo"; | 20 video.id = "testvideo"; |
44 waitForEvent('seeked', seeked); | 21 video.onseeked = t.step_func_done(function() { |
45 waitForEventOnce('canplaythrough', function() { video.currentTime = initialT
ime; }); | 22 var cueNode = textTrackDisplayElement(video, 'cue').firstElementChild; |
46 } | 23 assert_equals(getComputedStyle(cueNode).color, "rgb(255, 255, 255)"); |
| 24 cueNode = cueNode.nextElementSibling; |
| 25 assert_equals(getComputedStyle(cueNode).color, "rgb(255, 255, 255)"); |
| 26 cueNode = cueNode.nextElementSibling; |
| 27 assert_equals(getComputedStyle(cueNode).color, "rgb(255, 255, 255)"); |
| 28 }); |
| 29 video.currentTime = 0.6; |
| 30 }); |
47 </script> | 31 </script> |
48 </head> | |
49 <body onload="loaded()"> | |
50 <div id='host'> | |
51 </div> | |
52 </body> | |
53 </html> | |
OLD | NEW |