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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/track-css-matching-lang.html

Issue 1875923002: 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 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 <html> 2 <title>Test that cues are being matched properly by the lang attribute and :lang () pseudo class.</title>
3 <head> 3 <script src="../media-file.js"></script>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 4 <script src="../media-controls.js"></script>
5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script>
7 <style>
8 ::cue(:lang(ru)) { color: lime; }
9 ::cue(lang[lang="en"]) { color: purple; }
10 ::cue(c[lang="ru"]) { color: red; } /* Shouldn't work, no attribute 'lang' for ' c'. */
11 </style>
12 <video></video>
13 <script>
14 async_test(function(t) {
15 var video = document.querySelector('video');
16 video.src = findMediaFile('video', '../content/test');
17
18 var track = document.createElement('track');
19 track.src = 'captions-webvtt/styling-lang.vtt';
20 track.kind = 'captions';
21 track.default = true;
22 video.appendChild(track);
5 23
6 <script src=../media-file.js></script> 24 video.onseeked = t.step_func_done(function() {
7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 25 var cueNode = textTrackDisplayElement(video, 'cue').firstElementChild.fi rstElementChild;
8 (Please avoid writing new tests using video-test.js) --> 26 assert_equals(getComputedStyle(cueNode).color, 'rgb(128, 0, 128)');
9 <script src=../video-test.js></script> 27 cueNode = cueNode.firstElementChild.firstElementChild;
10 <script src=../media-controls.js></script> 28 assert_equals(getComputedStyle(cueNode).color, 'rgb(0, 255, 0)');
11 29 cueNode = cueNode.firstElementChild.firstElementChild;
12 <style> 30 assert_equals(getComputedStyle(cueNode).color, 'rgb(128, 0, 128)');
13 ::cue(:lang(ru)) { color: lime; } 31 });
14 ::cue(lang[lang="en"]) { color: purple; } 32
15 ::cue(c[lang="ru"]) { color: red; } /* Shouldn't work, no attribute 'lan g' for 'c'. */ 33 video.currentTime = 0.1;
16 </style> 34 });
17 35 </script>
18 <script>
19
20 var cueNode;
21 var seekedCount = 0;
22 var seekTimes = [0.1];
23
24 var info = [["rgb(128, 0, 128)", "rgb(0, 255, 0)", "rgb(128, 0, 128)"]];
25
26 function seeked()
27 {
28 if (testEnded)
29 return;
30
31 cueNode = textTrackDisplayElement(video, 'cue').firstElementChild.fi rstElementChild;
32 testExpected("getComputedStyle(cueNode).color", info[seekedCount][0] );
33 cueNode = cueNode.firstElementChild.firstElementChild;
34 testExpected("getComputedStyle(cueNode).color", info[seekedCount][1] );
35 cueNode = cueNode.firstElementChild.firstElementChild;
36 testExpected("getComputedStyle(cueNode).color", info[seekedCount][2] );
37
38 if (++seekedCount == info.length)
39 endTest();
40 else {
41 consoleWrite("");
42 run("video.currentTime = " + seekTimes[seekedCount]);
43 }
44 }
45
46 function loaded()
47 {
48 consoleWrite("Test that cues are being matched properly by the lang attribute and :lang() pseudo class.");
49 findMediaElement();
50 video.src = findMediaFile('video', '../content/test');
51 video.id = "testvideo";
52 waitForEvent('seeked', seeked);
53 waitForEvent('canplaythrough', function() { video.currentTime = seek Times[0]; });
54 }
55
56 </script>
57 </head>
58 <body onload="loaded()">
59 <video controls >
60 <track src="captions-webvtt/styling-lang.vtt" kind="captions" defaul t>
61 </video>
62 </body>
63 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698