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

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: 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 <video>
8 <track src="captions-webvtt/styling.vtt" kind="captions" default>
9 </video>
7 <script> 10 <script>
11 async_test(function(t) {
12 var video = document.querySelector("video");
13 video.src = findMediaFile("video", "../content/test");
mlamouri (slow - plz ping) 2016/04/13 12:58:30 ditto
8 14
9 function applyUserOverrideSettings() { 15 video.oncanplaythrough = t.step_func_done(function() {
10 if (window.internals) { 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 if (internals) {
11 internals.settings.setTextTrackTextColor("purple"); 26 internals.settings.setTextTrackTextColor("purple");
12 internals.settings.setTextTrackTextSize("14px"); 27 internals.settings.setTextTrackTextSize("14px");
13 } 28 }
14 }
15 29
16 function verifyDefaultSettings() { 30 video.currentTime = 0.3;
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 31
30 function checkExpected() { 32 cue = textTrackDisplayElement(video, "cue");
31 consoleWrite(""); 33 cueStyle = getComputedStyle(cue);
32 cue = textTrackDisplayElement(video, 'cue'); 34 assert_equals(cueStyle.color, "rgb(128, 0, 128)");
33 testExpected("getComputedStyle(cue).color", "rgb(128, 0, 128)"); 35 assert_equals(cueStyle.fontSize, "14px");
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 // 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 assert_equals(cueStyle.backgroundColor, "rgba(0, 0, 0, 0.8)");
37 testExpected("getComputedStyle(cue).fontFamily", "sans-serif"); 38 assert_equals(cueStyle.fontFamily, "sans-serif");
38 endTest(); 39 });
39 } 40 });
40 41 </script>
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>
51 <track src="captions-webvtt/styling.vtt" kind="captions" default>
52 </video>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698