Chromium Code Reviews| Index: LayoutTests/media/track/track-css-user-settings-override-internal-settings.html |
| diff --git a/LayoutTests/media/track/track-css-user-settings-override-internal-settings.html b/LayoutTests/media/track/track-css-user-settings-override-internal-settings.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7b1f9c26cb6fcb3af6056d0c08bca7ca24069828 |
| --- /dev/null |
| +++ b/LayoutTests/media/track/track-css-user-settings-override-internal-settings.html |
| @@ -0,0 +1,50 @@ |
| +<!DOCTYPE html> |
| +<script src=../media-file.js></script> |
| +<script src=../video-test.js></script> |
| +<script src=../media-controls.js></script> |
| +<script> |
| + |
| + function applyUserOverrideSettings() { |
| + if (window.internals) { |
| + internals.settings.setTextTrackTextColor("purple"); |
| + internals.settings.setTextTrackTextSize("14px"); |
| + } |
| + } |
| + |
| + function verifyDefaultSettings() { |
| + consoleWrite(""); |
| + cue = textTrackDisplayElement(video, 'cue'); |
| + // These are the expected default cue settings per spec |
| + // http://dev.w3.org/html5/webvtt/#applying-css-properties-to-webvtt-node-objects |
| + testExpected("getComputedStyle(cue).color", "rgb(255, 255, 255)"); |
| + testExpected("getComputedStyle(cue).backgroundColor", "rgba(0, 0, 0, 0.8)"); |
| + testExpected("getComputedStyle(cue).fontFamily", "sans-serif"); |
| + // Apply user settings for color and font-size and verify that the other internal settings are retained. |
| + applyUserOverrideSettings(); |
| + run("video.currentTime = 0.3"); |
| + checkExpected(); |
| + } |
| + |
| + function checkExpected() { |
| + consoleWrite(""); |
| + cue = textTrackDisplayElement(video, 'cue'); |
| + testExpected("getComputedStyle(cue).color", "rgb(128, 0, 128)"); |
| + testExpected("getComputedStyle(cue).fontSize", "14px"); |
| + // When there is no user setting specified for background-color and font-family, the internal settings are applied. |
| + testExpected("getComputedStyle(cue).backgroundColor", "rgba(0, 0, 0, 0.8)"); |
| + testExpected("getComputedStyle(cue).fontFamily", "sans-serif"); |
| + endTest(); |
| + } |
| + |
| + window.onload = function() { |
| + consoleWrite("Test that WebVTT objects are being styled correctly based on user settings that should override app default settings."); |
| + findMediaElement(); |
| + video.src = findMediaFile('video', '../content/test'); |
| + waitForEvent('seeked', verifyDefaultSettings); |
| + waitForEvent('canplaythrough', function() { video.currentTime = 0.1; }); |
|
philipj_slow
2015/03/26 05:24:36
To simplify, you can set currentTime immediate aft
srivats
2015/03/26 06:37:42
Done.
|
| + } |
| + |
| +</script> |
| +<video> |
| + <track src="captions-webvtt/styling.vtt" kind="captions" default> |
| +</video> |