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..1aeed98cb22f043111e9bd3abf62c943665f11e4 |
--- /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 default settings."); |
+ findMediaElement(); |
+ video.src = findMediaFile('video', '../content/test'); |
+ video.currentTime = 0.1; |
+ waitForEvent('canplaythrough', verifyDefaultSettings); |
+ } |
+ |
+</script> |
+<video> |
+ <track src="captions-webvtt/styling.vtt" kind="captions" default> |
+</video> |