Chromium Code Reviews| Index: LayoutTests/media/track/track-css-user-settings-override-author-settings.html |
| diff --git a/LayoutTests/media/track/track-css-user-settings-override-author-settings.html b/LayoutTests/media/track/track-css-user-settings-override-author-settings.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cf8177ecdb3a14bc896cba61da7876a6431ccacd |
| --- /dev/null |
| +++ b/LayoutTests/media/track/track-css-user-settings-override-author-settings.html |
| @@ -0,0 +1,81 @@ |
| +<!DOCTYPE html> |
| +<script src=../media-file.js></script> |
| +<script src=../video-test.js></script> |
| +<script src=../media-controls.js></script> |
| +<style> |
| + /* App default settings for the cues */ |
|
philipj_slow
2015/03/26 05:24:36
I'm not sure what app means, both of these style b
srivats
2015/03/26 06:37:42
The app default settings block was supposed to ove
|
| + video::cue { |
| + color: lime; |
| + background-color: yellow; |
| + text-shadow: 4px 4px #ff0000; |
| + font-size: 10px; |
| + font-family: serif; |
| + font-style: normal; |
| + font-variant: normal; |
| + } |
| + /* Author settings for the cues */ |
| + video::cue(c) { |
|
philipj_slow
2015/03/26 05:24:36
Does this style block (and the change to styling.v
srivats
2015/03/26 06:37:41
This specifies the author settings for the cue nod
|
| + color: red; |
| + background-color: green; |
| + text-shadow: 3px 3px #00ff00; |
| + font-size: 20px; |
| + font-family: arial; |
| + font-style: normal; |
| + font-variant: normal; |
| + } |
| +</style> |
| +<script> |
| + |
| + function applyUserOverrideSettings() { |
| + if (window.internals) { |
| + internals.settings.setTextTrackTextColor("cyan"); |
| + internals.settings.setTextTrackBackgroundColor("green"); |
| + internals.settings.setTextTrackTextShadow("2px 2px #ff0000") |
| + internals.settings.setTextTrackTextSize("14px"); |
| + internals.settings.setTextTrackFontFamily("fantasy"); |
| + 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'); |
| + waitForEvent('seeked', verifyAuthorSettings); |
| + waitForEvent('canplaythrough', function() { video.currentTime = 0.1; }); |
|
philipj_slow
2015/03/26 05:24:36
Same simplification possible.
srivats
2015/03/26 06:37:42
Done.
|
| + } |
| + |
| +</script> |
| +<video> |
| + <track src="captions-webvtt/styling.vtt" kind="captions" default> |
| +</video> |