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

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

Issue 1882583002: Convert track tests from video-test.js to testharness.js based (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments Created 4 years, 8 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 <script src=../media-file.js></script> 2 <title>Test that WebVTT objects are being styled correctly based on user setting s that should override default settings.</title>
3 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 3 <script src="../media-file.js"></script>
4 (Please avoid writing new tests using video-test.js) --> 4 <script src="../media-controls.js"></script>
5 <script src=../video-test.js></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src=../media-controls.js></script> 6 <script src="../../resources/testharnessreport.js"></script>
7 <script>
8
9 function applyUserOverrideSettings() {
10 if (window.internals) {
11 internals.settings.setTextTrackTextColor("purple");
12 internals.settings.setTextTrackTextSize("14px");
13 }
14 }
15
16 function verifyDefaultSettings() {
17 consoleWrite("");
18 cue = textTrackDisplayElement(video, 'cue');
19 // These are the expected default cue settings per spec
20 // http://dev.w3.org/html5/webvtt/#applying-css-properties-to-webvtt-nod e-objects
21 testExpected("getComputedStyle(cue).color", "rgb(255, 255, 255)");
22 testExpected("getComputedStyle(cue).backgroundColor", "rgba(0, 0, 0, 0.8 )");
23 testExpected("getComputedStyle(cue).fontFamily", "sans-serif");
24 // Apply user settings for color and font-size and verify that the other internal settings are retained.
25 applyUserOverrideSettings();
26 run("video.currentTime = 0.3");
27 checkExpected();
28 }
29
30 function checkExpected() {
31 consoleWrite("");
32 cue = textTrackDisplayElement(video, 'cue');
33 testExpected("getComputedStyle(cue).color", "rgb(128, 0, 128)");
34 testExpected("getComputedStyle(cue).fontSize", "14px");
35 // When there is no user setting specified for background-color and font -family, the internal settings are applied.
36 testExpected("getComputedStyle(cue).backgroundColor", "rgba(0, 0, 0, 0.8 )");
37 testExpected("getComputedStyle(cue).fontFamily", "sans-serif");
38 endTest();
39 }
40
41 window.onload = function() {
42 consoleWrite("Test that WebVTT objects are being styled correctly based on user settings that should override default settings.");
43 findMediaElement();
44 video.src = findMediaFile('video', '../content/test');
45 video.currentTime = 0.1;
46 waitForEvent('canplaythrough', verifyDefaultSettings);
47 }
48
49 </script>
50 <video> 7 <video>
51 <track src="captions-webvtt/styling.vtt" kind="captions" default> 8 <track src="captions-webvtt/styling.vtt" kind="captions" default>
52 </video> 9 </video>
10 <script>
11 async_test(function(t) {
12 var video = document.querySelector("video");
13 video.src = findMediaFile("video", "../content/test");
14
15 video.oncanplaythrough = t.step_func_done(function() {
16 var cue = textTrackDisplayElement(video, "cue");
17 var cueStyle = getComputedStyle(cue);
18 // These are the expected default cue settings per spec
19 // http://dev.w3.org/html5/webvtt/#applying-css-properties-to-webvtt-nod e-objects
20 assert_equals(cueStyle.color, "rgb(255, 255, 255)");
21 assert_equals(cueStyle.backgroundColor, "rgba(0, 0, 0, 0.8)");
22 assert_equals(cueStyle.fontFamily, "sans-serif");
23
24 // Apply user settings for color and font-size and verify that the other internal settings are retained.
25 internals.settings.setTextTrackTextColor("purple");
26 internals.settings.setTextTrackTextSize("14px");
27
28 video.currentTime = 0.3;
29
30 cue = textTrackDisplayElement(video, "cue");
31 cueStyle = getComputedStyle(cue);
32 assert_equals(cueStyle.color, "rgb(128, 0, 128)");
33 assert_equals(cueStyle.fontSize, "14px");
34 // When there is no user setting specified for background-color and font -family, the internal settings are applied.
35 assert_equals(cueStyle.backgroundColor, "rgba(0, 0, 0, 0.8)");
36 assert_equals(cueStyle.fontFamily, "sans-serif");
37 });
38 });
39 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698