Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1388)

Side by Side Diff: LayoutTests/media/track/track-css-matching-user-override-settings.html

Issue 921833003: Expose APIs for text track settings (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Override author-specified caption settings with user-specified caption settings Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src=../media-file.js></script>
3 <script src=../video-test.js></script>
4 <script src=../media-controls.js></script>
5 <style>
6 /* App default settings for the cues */
7 video::cue {
8 color: lime;
9 background-color: yellow;
10 text-shadow: 4px 4px #ff0000;
11 font-size: 10px;
12 font-family: serif;
13 font-style: normal;
14 font-variant: normal;
15 }
16 /* Author settings for the cues */
17 video::cue(c) {
18 color: red;
19 background-color: green;
20 text-shadow: 3px 3px #00ff00;
21 font-size: 20px;
22 font-family: arial;
23 font-style: normal;
24 font-variant: normal;
25 }
26 </style>
27 <script>
28
29 function applyUserOverrideSettings() {
30 if (window.internals) {
31 internals.settings.setPlatformClosedCaptionsEnabled(true);
32 internals.settings.setTextTrackTextColor("cyan");
33 internals.settings.setTextTrackBackgroundColor("green");
34 internals.settings.setTextTrackTextShadow("2px 2px #ff0000")
35 internals.settings.setTextTrackTextSize("14px");
36 internals.settings.setTextTrackFontFamily("fantasy");
37 internals.settings.setTextTrackFontStyle("italic");
38 internals.settings.setTextTrackFontVariant("small-caps");
39 }
40 }
41
42 function verifyAuthorSettings()
43 {
44 consoleWrite("");
45 cue = textTrackDisplayElement(video, 'cue').firstElementChild;
46 testExpected("getComputedStyle(cue).color", "rgb(255, 0, 0)");
47 testExpected("getComputedStyle(cue).backgroundColor", "rgb(0, 128, 0)");
48 testExpected("getComputedStyle(cue).textShadow", "rgb(0, 255, 0) 3px 3px 0px");
49 testExpected("getComputedStyle(cue).fontSize", "20px");
50 testExpected("getComputedStyle(cue).fontFamily", "arial");
51 testExpected("getComputedStyle(cue).fontStyle", "normal");
52 testExpected("getComputedStyle(cue).fontVariant", "normal");
53 // Apply user settings and verify they override author-specified setting s
54 applyUserOverrideSettings();
55 run("video.currentTime = 0.3");
56 verifyUserOverrideSettings();
57 }
58
59 function verifyUserOverrideSettings() {
60 consoleWrite("");
61 cue = textTrackDisplayElement(video, 'cue').firstElementChild;
62 testExpected("getComputedStyle(cue).color", "rgb(0, 255, 255)");
63 testExpected("getComputedStyle(cue).backgroundColor", "rgb(0, 128, 0)");
64 testExpected("getComputedStyle(cue).textShadow", "rgb(255, 0, 0) 2px 2px 0px");
65 testExpected("getComputedStyle(cue).fontSize", "14px");
66 testExpected("getComputedStyle(cue).fontFamily", "fantasy");
67 testExpected("getComputedStyle(cue).fontStyle", "italic");
68 testExpected("getComputedStyle(cue).fontVariant", "small-caps");
69 endTest();
70 }
71
72 window.onload = function() {
73 consoleWrite("Test that WebVTT objects are being styled correctly based on user settings.");
74 findMediaElement();
75 video.src = findMediaFile('video', '../content/test');
76 waitForEvent('seeked', verifyAuthorSettings);
77 waitForEvent('canplaythrough', function() { video.currentTime = 0.1; });
78 }
79
80 </script>
81 <video>
82 <track src="captions-webvtt/styling.vtt" kind="captions" default>
83 </video>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698