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

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

Issue 2268923003: Clean up textTrackDisplayElement utility function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 3 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Test that WebVTT objects are being styled correctly based on user setting s that should override author settings.</title> 2 <title>Test that WebVTT objects are being styled correctly based on user setting s that should override author settings.</title>
3 <script src="../media-file.js"></script> 3 <script src="../media-file.js"></script>
4 <script src="../media-controls.js"></script> 4 <script src="../media-controls.js"></script>
5 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script> 6 <script src="../../resources/testharnessreport.js"></script>
7 <style> 7 <style>
8 /* Author settings for the cues */ 8 /* Author settings for the cues */
9 video::cue(c) { 9 video::cue(c) {
10 color: red; 10 color: red;
11 background-color: green; 11 background-color: green;
12 text-shadow: 3px 3px #00ff00; 12 text-shadow: 3px 3px #00ff00;
13 font-size: 20px; 13 font-size: 20px;
14 font-family: arial; 14 font-family: arial;
15 font-style: normal; 15 font-style: normal;
16 font-variant: normal; 16 font-variant: normal;
17 } 17 }
18 </style> 18 </style>
19 <video> 19 <video>
20 <track src="captions-webvtt/styling.vtt" kind="captions" default> 20 <track src="captions-webvtt/styling.vtt" kind="captions" default>
21 </video> 21 </video>
22 <script> 22 <script>
23 async_test(function(t) { 23 async_test(function(t) {
24 var video = document.querySelector("video"); 24 var video = document.querySelector("video");
25 video.src = findMediaFile("video", "../content/test"); 25 video.src = findMediaFile("video", "../content/test");
26 26
27 video.oncanplaythrough = t.step_func_done(function() { 27 video.oncanplaythrough = t.step_func_done(function() {
28 var cue = textTrackDisplayElement(video, "cue").firstElementChild; 28 var cue = textTrackCueElementByIndex(video, 0).firstChild.firstElementCh ild;
29 var cueStyle = getComputedStyle(cue); 29 var cueStyle = getComputedStyle(cue);
30 assert_equals(cueStyle.color, "rgb(255, 0, 0)"); 30 assert_equals(cueStyle.color, "rgb(255, 0, 0)");
31 assert_equals(cueStyle.backgroundColor, "rgb(0, 128, 0)"); 31 assert_equals(cueStyle.backgroundColor, "rgb(0, 128, 0)");
32 assert_equals(cueStyle.textShadow, "rgb(0, 255, 0) 3px 3px 0px"); 32 assert_equals(cueStyle.textShadow, "rgb(0, 255, 0) 3px 3px 0px");
33 assert_equals(cueStyle.fontSize, "20px"); 33 assert_equals(cueStyle.fontSize, "20px");
34 assert_equals(cueStyle.fontFamily, "arial"); 34 assert_equals(cueStyle.fontFamily, "arial");
35 assert_equals(cueStyle.fontStyle, "normal"); 35 assert_equals(cueStyle.fontStyle, "normal");
36 assert_equals(cueStyle.fontVariant, "normal"); 36 assert_equals(cueStyle.fontVariant, "normal");
37 37
38 // Apply user settings and verify they override author-specified setting s 38 // Apply user settings and verify they override author-specified setting s
39 internals.settings.setTextTrackTextColor("cyan"); 39 internals.settings.setTextTrackTextColor("cyan");
40 internals.settings.setTextTrackBackgroundColor("green"); 40 internals.settings.setTextTrackBackgroundColor("green");
41 internals.settings.setTextTrackTextShadow("2px 2px #ff0000") 41 internals.settings.setTextTrackTextShadow("2px 2px #ff0000")
42 internals.settings.setTextTrackTextSize("14px"); 42 internals.settings.setTextTrackTextSize("14px");
43 internals.settings.setTextTrackFontFamily("fantasy"); 43 internals.settings.setTextTrackFontFamily("fantasy");
44 internals.settings.setTextTrackFontStyle("italic"); 44 internals.settings.setTextTrackFontStyle("italic");
45 internals.settings.setTextTrackFontVariant("small-caps"); 45 internals.settings.setTextTrackFontVariant("small-caps");
46 46
47 video.currentTime = 0.3; 47 video.currentTime = 0.3;
48 48
49 cue = textTrackDisplayElement(video, "cue").firstElementChild; 49 cue = textTrackCueElementByIndex(video, 0).firstChild.firstElementChild;
50 cueStyle = getComputedStyle(cue); 50 cueStyle = getComputedStyle(cue);
51 assert_equals(cueStyle.color, "rgb(0, 255, 255)"); 51 assert_equals(cueStyle.color, "rgb(0, 255, 255)");
52 assert_equals(cueStyle.backgroundColor, "rgb(0, 128, 0)"); 52 assert_equals(cueStyle.backgroundColor, "rgb(0, 128, 0)");
53 assert_equals(cueStyle.textShadow, "rgb(255, 0, 0) 2px 2px 0px"); 53 assert_equals(cueStyle.textShadow, "rgb(255, 0, 0) 2px 2px 0px");
54 assert_equals(cueStyle.fontSize, "14px"); 54 assert_equals(cueStyle.fontSize, "14px");
55 assert_equals(cueStyle.fontFamily, "fantasy"); 55 assert_equals(cueStyle.fontFamily, "fantasy");
56 assert_equals(cueStyle.fontStyle, "italic"); 56 assert_equals(cueStyle.fontStyle, "italic");
57 assert_equals(cueStyle.fontVariant, "small-caps"); 57 assert_equals(cueStyle.fontVariant, "small-caps");
58 }); 58 });
59 }); 59 });
60 </script> 60 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698