| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <title>Test that the cue is styled properly throughout its lifetime.</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::cue(.red, .red2) { color:red } |
| 9 video::cue(.green) { color:green } |
| 10 </style> |
| 11 <video></video> |
| 12 <script> |
| 13 async_test(function(t) { |
| 14 var seekTimeIndex = 0; |
| 15 var step = 0.4; |
| 16 var initialTime = 0.6; |
| 17 var endTime = 3.0 |
| 18 |
| 19 var video = document.querySelector('video'); |
| 20 video.src = findMediaFile('video', '../content/test'); |
| 5 | 21 |
| 6 <script src=../media-file.js></script> | 22 var track = document.createElement('track'); |
| 7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 23 track.src = 'captions-webvtt/styling-lifetime.vtt'; |
| 8 (Please avoid writing new tests using video-test.js) --> | 24 track.kind = 'captions'; |
| 9 <script src=../video-test.js></script> | 25 track.default = true; |
| 10 <script src=../media-controls.js></script> | 26 video.appendChild(track); |
| 11 | 27 |
| 12 <style> | 28 video.onseeked = t.step_func(function() { |
| 13 video::cue(.red, .red2) { color:red } | 29 var cueNode = textTrackDisplayElement(video, 'cue').firstElementChild; |
| 14 video::cue(.green) { color:green } | 30 assert_equals(getComputedStyle(cueNode).color, 'rgb(255, 0, 0)'); |
| 15 </style> | 31 cueNode = cueNode.nextElementSibling; |
| 32 assert_equals(getComputedStyle(cueNode).color, 'rgb(0, 128, 0)'); |
| 33 cueNode = cueNode.nextElementSibling; |
| 34 assert_equals(getComputedStyle(cueNode).color, 'rgb(255, 0, 0)'); |
| 16 | 35 |
| 17 <script> | 36 var seekTime = ++seekTimeIndex * step + initialTime; |
| 18 | 37 if (seekTime > endTime) |
| 19 var cueNode; | 38 t.done(); |
| 20 var seekedCount = 0; | 39 else |
| 21 var step = 0.4; | 40 video.currentTime = seekTime; |
| 22 var initialTime = 0.6; | 41 }); |
| 23 var endTime = 3.0 | 42 |
| 24 | 43 video.currentTime = initialTime; |
| 25 function seeked() | 44 }); |
| 26 { | 45 </script> |
| 27 if (testEnded) | |
| 28 return; | |
| 29 | |
| 30 cueNode = textTrackDisplayElement(video, 'cue').firstElementChild; | |
| 31 testExpected("getComputedStyle(cueNode).color", "rgb(255, 0, 0)"); | |
| 32 cueNode = cueNode.nextElementSibling; | |
| 33 testExpected("getComputedStyle(cueNode).color", "rgb(0, 128, 0)"); | |
| 34 cueNode = cueNode.nextElementSibling; | |
| 35 testExpected("getComputedStyle(cueNode).color", "rgb(255, 0, 0)"); | |
| 36 | |
| 37 if (++seekedCount * step + initialTime > endTime) | |
| 38 endTest(); | |
| 39 else { | |
| 40 consoleWrite("" + seekedCount); | |
| 41 run("video.currentTime = " + Math.round(initialTime + seekedCoun
t * step * 10) / 10); | |
| 42 } | |
| 43 } | |
| 44 | |
| 45 function loaded() | |
| 46 { | |
| 47 consoleWrite("Test that the cue is styled properly throughout its li
fetime."); | |
| 48 findMediaElement(); | |
| 49 video.src = findMediaFile('video', '../content/test'); | |
| 50 video.id = "testvideo"; | |
| 51 waitForEvent('seeked', seeked); | |
| 52 waitForEventOnce('canplaythrough', function() { video.currentTime =
initialTime; }); | |
| 53 } | |
| 54 | |
| 55 </script> | |
| 56 </head> | |
| 57 <body onload="loaded()"> | |
| 58 <video controls > | |
| 59 <track src="captions-webvtt/styling-lifetime.vtt" kind="captions" de
fault> | |
| 60 </video> | |
| 61 </body> | |
| 62 </html> | |
| OLD | NEW |