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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render.html

Issue 1887943002: 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 <html> 2 <title>Test that cues are rendered and removed.</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 <video>
8 <track src="captions-webvtt/captions-gaps.vtt" kind="captions" default>
9 </video>
10 <script>
11 async_test(function(t) {
12 var video = document.querySelector("video");
13 var testTrack = document.querySelector("track");
14 video.src = findMediaFile("video", "../content/counting");
15
16 var seekTimeIndex = 0;
17 var info = [
18 0.5, "",
19 1.5, "Lorem ipsum dolor sit amet,",
20 2.5, "",
21 3.3, "consectetuer adipiscing elit,",
22 0.6, "",
23 5.9, "sed diam nonummy nibh euismod tincidunt",
24 4.4, "",
25 7.9, "ut laoreet dolore magna aliquam erat volutpat."
26 ];
5 27
6 <script src=../media-file.js></script> 28 video.onseeked = t.step_func(function() {
7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 29 var time = info[seekTimeIndex];
8 (Please avoid writing new tests using video-test.js) --> 30 assert_equals(video.currentTime, time);
9 <script src=../video-test.js></script> 31 var cueText = info[++seekTimeIndex];
10 <script src=../media-controls.js></script> 32 ++seekTimeIndex;
11 33
12 <script> 34 assert_equals(video.currentTime.toFixed(1), time.toFixed(1));
13 35 if (cueText.length) {
14 var testTrack; 36 assert_equals(testTrack.track.activeCues[0].text, cueText);
15 var seekedCount = 0; 37 assert_equals(textTrackDisplayElement(video, "display").innerText, c ueText);
mlamouri (slow - plz ping) 2016/04/19 15:16:29 It seems that this could be outside of the if/else
Srirama 2016/04/19 16:31:02 As i mentioned in my previous CL, this is also sam
16 var info = [ 38 } else {
17 0.5, "", 39 assert_equals(testTrack.track.activeCues.length, 0);
18 1.5, "Lorem ipsum dolor sit amet,",
19 2.5, "",
20 3.3, "consectetuer adipiscing elit,",
21 0.6, "",
22 5.9, "sed diam nonummy nibh euismod tincidunt",
23 4.4, "",
24 7.9, "ut laoreet dolore magna aliquam erat volutpat."
25 ];
26
27 function seeked()
28 {
29 var time = info[seekedCount];
30 var cueText = info[seekedCount + 1];
31 seekedCount += 2;
32
33 testExpected("video.currentTime.toFixed(1)", time.toFixed(1));
34 if (cueText.length)
35 testExpected("testTrack.track.activeCues[0].text", cueText);
36 testExpected("textTrackDisplayElement(video, 'display').innerText", cueText);
37
38 if (seekedCount >= info.length) {
39 consoleWrite("");
40 endTest();
41 return;
42 }
43
44 consoleWrite("");
45 run("video.currentTime = " + (info[seekedCount]));
46 } 40 }
47 41
48 function loaded() 42 if (seekTimeIndex >= info.length)
49 { 43 t.done();
50 findMediaElement();
51 testTrack = document.querySelector('track');
52 video.src = findMediaFile('video', '../content/counting');
53 waitForEvent('seeked', seeked);
54 waitForEventOnce('canplaythrough', function() { video.currentTime = .5; });
55 }
56 44
57 </script> 45 video.currentTime = info[seekTimeIndex];
58 </head> 46 });
59 <body onload="loaded()"> 47
60 <video controls > 48 video.currentTime = 0.5;
philipj_slow 2016/04/21 12:46:15 Use info[0] here?
61 <track src="captions-webvtt/captions-gaps.vtt" kind="captions" defau lt> 49 });
62 </video> 50 </script>
63 <p>Test that cues are rendered and removed.</p>
64 </body>
65 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698