Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/track/track-css-user-settings-override-author-settings.html |
| diff --git a/third_party/WebKit/LayoutTests/media/track/track-css-user-settings-override-author-settings.html b/third_party/WebKit/LayoutTests/media/track/track-css-user-settings-override-author-settings.html |
| index 206200a5b33562396afc9d7959e029cd0a17da81..1db399bb07397669777489ad13be04fe05511112 100644 |
| --- a/third_party/WebKit/LayoutTests/media/track/track-css-user-settings-override-author-settings.html |
| +++ b/third_party/WebKit/LayoutTests/media/track/track-css-user-settings-override-author-settings.html |
| @@ -1,25 +1,42 @@ |
| <!DOCTYPE html> |
| -<script src=../media-file.js></script> |
| -<!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
| - (Please avoid writing new tests using video-test.js) --> |
| -<script src=../video-test.js></script> |
| -<script src=../media-controls.js></script> |
| +<title>Test that WebVTT objects are being styled correctly based on user settings that should override author settings.</title> |
| +<script src="../media-file.js"></script> |
| +<script src="../media-controls.js"></script> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| <style> |
| - /* Author settings for the cues */ |
| - video::cue(c) { |
| - color: red; |
| - background-color: green; |
| - text-shadow: 3px 3px #00ff00; |
| - font-size: 20px; |
| - font-family: arial; |
| - font-style: normal; |
| - font-variant: normal; |
| - } |
| +/* Author settings for the cues */ |
| +video::cue(c) { |
| + color: red; |
| + background-color: green; |
| + text-shadow: 3px 3px #00ff00; |
| + font-size: 20px; |
| + font-family: arial; |
| + font-style: normal; |
| + font-variant: normal; |
| +} |
| </style> |
| +<video> |
| + <track src="captions-webvtt/styling.vtt" kind="captions" default> |
| +</video> |
| <script> |
| +async_test(function(t) { |
| + var video = document.querySelector("video"); |
| + video.src = findMediaFile("video", "../content/test"); |
|
mlamouri (slow - plz ping)
2016/04/13 12:58:30
The test used to wait for the load event and set c
Srirama
2016/04/13 13:19:46
Previously we are calling findMediaElement() to ge
philipj_slow
2016/04/15 14:04:50
AFAICT, it was just because the video element was
|
| - function applyUserOverrideSettings() { |
| - if (window.internals) { |
| + video.oncanplaythrough = t.step_func_done(function() { |
| + var cue = textTrackDisplayElement(video, "cue").firstElementChild; |
| + var cueStyle = getComputedStyle(cue); |
| + assert_equals(cueStyle.color, "rgb(255, 0, 0)"); |
| + assert_equals(cueStyle.backgroundColor, "rgb(0, 128, 0)"); |
| + assert_equals(cueStyle.textShadow, "rgb(0, 255, 0) 3px 3px 0px"); |
| + assert_equals(cueStyle.fontSize, "20px"); |
| + assert_equals(cueStyle.fontFamily, "arial"); |
| + assert_equals(cueStyle.fontStyle, "normal"); |
| + assert_equals(cueStyle.fontVariant, "normal"); |
| + |
| + // Apply user settings and verify they override author-specified settings |
| + if (internals) { |
|
philipj_slow
2016/04/15 14:04:50
Need to say window.internals, otherwise it'll thro
Srirama
2016/04/16 06:44:32
It is working without "window." prefix as well, I
philipj_slow
2016/04/21 11:38:09
It works as long as window.internals exists, but t
|
| internals.settings.setTextTrackTextColor("cyan"); |
| internals.settings.setTextTrackBackgroundColor("green"); |
| internals.settings.setTextTrackTextShadow("2px 2px #ff0000") |
| @@ -28,46 +45,18 @@ |
| internals.settings.setTextTrackFontStyle("italic"); |
| internals.settings.setTextTrackFontVariant("small-caps"); |
| } |
| - } |
| - |
| - function verifyAuthorSettings() { |
| - consoleWrite(""); |
| - cue = textTrackDisplayElement(video, 'cue').firstElementChild; |
| - testExpected("getComputedStyle(cue).color", "rgb(255, 0, 0)"); |
| - testExpected("getComputedStyle(cue).backgroundColor", "rgb(0, 128, 0)"); |
| - testExpected("getComputedStyle(cue).textShadow", "rgb(0, 255, 0) 3px 3px 0px"); |
| - testExpected("getComputedStyle(cue).fontSize", "20px"); |
| - testExpected("getComputedStyle(cue).fontFamily", "arial"); |
| - testExpected("getComputedStyle(cue).fontStyle", "normal"); |
| - testExpected("getComputedStyle(cue).fontVariant", "normal"); |
| - // Apply user settings and verify they override author-specified settings |
| - applyUserOverrideSettings(); |
| - run("video.currentTime = 0.3"); |
| - verifyUserOverrideSettings(); |
| - } |
| - function verifyUserOverrideSettings() { |
| - consoleWrite(""); |
| - cue = textTrackDisplayElement(video, 'cue').firstElementChild; |
| - testExpected("getComputedStyle(cue).color", "rgb(0, 255, 255)"); |
| - testExpected("getComputedStyle(cue).backgroundColor", "rgb(0, 128, 0)"); |
| - testExpected("getComputedStyle(cue).textShadow", "rgb(255, 0, 0) 2px 2px 0px"); |
| - testExpected("getComputedStyle(cue).fontSize", "14px"); |
| - testExpected("getComputedStyle(cue).fontFamily", "fantasy"); |
| - testExpected("getComputedStyle(cue).fontStyle", "italic"); |
| - testExpected("getComputedStyle(cue).fontVariant", "small-caps"); |
| - endTest(); |
| - } |
| - |
| - window.onload = function() { |
| - consoleWrite("Test that WebVTT objects are being styled correctly based on user settings that should override author settings."); |
| - findMediaElement(); |
| - video.src = findMediaFile('video', '../content/test'); |
| - video.currentTime = 0.1; |
| - waitForEvent('canplaythrough', verifyAuthorSettings); |
| - } |
| - |
| -</script> |
| -<video> |
| - <track src="captions-webvtt/styling.vtt" kind="captions" default> |
| -</video> |
| + video.currentTime = 0.3; |
|
philipj_slow
2016/04/15 14:04:50
Does the test still pass without this? There's a n
Srirama
2016/04/16 06:44:32
It doesn't pass without this, so i kept it. It doe
philipj_slow
2016/04/21 11:38:09
Well it does seek to another cue, so this line doe
|
| + |
| + cue = textTrackDisplayElement(video, "cue").firstElementChild; |
| + cueStyle = getComputedStyle(cue); |
| + assert_equals(cueStyle.color, "rgb(0, 255, 255)"); |
| + assert_equals(cueStyle.backgroundColor, "rgb(0, 128, 0)"); |
| + assert_equals(cueStyle.textShadow, "rgb(255, 0, 0) 2px 2px 0px"); |
| + assert_equals(cueStyle.fontSize, "14px"); |
| + assert_equals(cueStyle.fontFamily, "fantasy"); |
| + assert_equals(cueStyle.fontStyle, "italic"); |
| + assert_equals(cueStyle.fontVariant, "small-caps"); |
| + }); |
| +}); |
| +</script> |