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

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

Issue 921833003: Expose APIs for text track settings (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase and added a test to verify behavior of internal 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 */
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
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) {
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
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.setTextTrackTextColor("cyan");
32 internals.settings.setTextTrackBackgroundColor("green");
33 internals.settings.setTextTrackTextShadow("2px 2px #ff0000")
34 internals.settings.setTextTrackTextSize("14px");
35 internals.settings.setTextTrackFontFamily("fantasy");
36 internals.settings.setTextTrackFontStyle("italic");
37 internals.settings.setTextTrackFontVariant("small-caps");
38 }
39 }
40
41 function verifyAuthorSettings() {
42 consoleWrite("");
43 cue = textTrackDisplayElement(video, 'cue').firstElementChild;
44 testExpected("getComputedStyle(cue).color", "rgb(255, 0, 0)");
45 testExpected("getComputedStyle(cue).backgroundColor", "rgb(0, 128, 0)");
46 testExpected("getComputedStyle(cue).textShadow", "rgb(0, 255, 0) 3px 3px 0px");
47 testExpected("getComputedStyle(cue).fontSize", "20px");
48 testExpected("getComputedStyle(cue).fontFamily", "arial");
49 testExpected("getComputedStyle(cue).fontStyle", "normal");
50 testExpected("getComputedStyle(cue).fontVariant", "normal");
51 // Apply user settings and verify they override author-specified setting s
52 applyUserOverrideSettings();
53 run("video.currentTime = 0.3");
54 verifyUserOverrideSettings();
55 }
56
57 function verifyUserOverrideSettings() {
58 consoleWrite("");
59 cue = textTrackDisplayElement(video, 'cue').firstElementChild;
60 testExpected("getComputedStyle(cue).color", "rgb(0, 255, 255)");
61 testExpected("getComputedStyle(cue).backgroundColor", "rgb(0, 128, 0)");
62 testExpected("getComputedStyle(cue).textShadow", "rgb(255, 0, 0) 2px 2px 0px");
63 testExpected("getComputedStyle(cue).fontSize", "14px");
64 testExpected("getComputedStyle(cue).fontFamily", "fantasy");
65 testExpected("getComputedStyle(cue).fontStyle", "italic");
66 testExpected("getComputedStyle(cue).fontVariant", "small-caps");
67 endTest();
68 }
69
70 window.onload = function() {
71 consoleWrite("Test that WebVTT objects are being styled correctly based on user settings that should override author settings.");
72 findMediaElement();
73 video.src = findMediaFile('video', '../content/test');
74 waitForEvent('seeked', verifyAuthorSettings);
75 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.
76 }
77
78 </script>
79 <video>
80 <track src="captions-webvtt/styling.vtt" kind="captions" default>
81 </video>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698