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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/track-cues-seeking.html

Issue 2061663002: Convert track-cues* and track-word* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nit Created 4 years, 6 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>Tests TextTrack's activeCues are indexed and updated during video playbac k.</title>
3 <head> 3 <script src="../../resources/testharness.js"></script>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 4 <script src="../../resources/testharnessreport.js"></script>
5 <script src="../media-file.js"></script>
6 <video>
7 <track src="captions-webvtt/cues-overlapping.vtt" kind="subtitles" default>
8 </video>
9 <script>
10 async_test(function(t) {
11 var video = document.querySelector("video");
12 var track = document.querySelector("track");
13 track.onload = t.step_func(function() {
14 assert_equals(track.track.cues.length, 3);
15 video.src = findMediaFile("video", "../content/test");
16 video.currentTime = 0.5;
17 });
5 18
6 <script src=../media-file.js></script> 19 var seekedCount = 0;
7 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 20 video.onseeked = t.step_func(function() {
8 (Please avoid writing new tests using video-test.js) --> 21 ++seekedCount;
9 <script src=../video-test.js></script>
10 22
11 <script> 23 assert_equals(video.currentTime, seekedCount * 0.5);
24 assert_equals(track.track.activeCues.length, seekedCount - 1);
25 video.currentTime = (seekedCount + 1) * 0.5;
12 26
13 var seekedCount = 0; 27 if (seekedCount == 4)
14 var testTrack; 28 t.done();
15 29 });
16 var trackLoaded = false; 30 });
17 var videoCanPlayThrough = false; 31 </script>
18
19 function attemptTests()
20 {
21 if (!trackLoaded || !videoCanPlayThrough)
22 return;
23
24 testTrack = document.getElementById("testTrack");
25 testExpected("testTrack.track.cues.length", 3);
26 run("video.currentTime = 0.5");
27 consoleWrite("");
28 }
29
30 function seeked()
31 {
32 ++seekedCount;
33 consoleWrite("");
34
35 activeCues = testTrack.track.activeCues;
36
37 testExpected("video.currentTime", seekedCount * 0.5);
38 testExpected("activeCues.length", seekedCount - 1);
39 run("video.currentTime = " + (seekedCount + 1) * 0.5);
40
41 consoleWrite("");
42
43 if (seekedCount == 4)
44 endTest();
45 }
46
47 waitForEvent('seeked', seeked);
48
49 waitForEventOnce('canplaythrough',
50 function ()
51 {
52 videoCanPlayThrough = true;
53 attemptTests();
54 }
55 );
56
57 function loaded()
58 {
59 trackLoaded = true;
60 attemptTests();
61 }
62
63 function start()
64 {
65 findMediaElement();
66 video.src = findMediaFile("video", "../content/test");
67 }
68 </script>
69 </head>
70 <body onload="start()">
71 <p>Tests TextTrack's activeCues are indexed and updated during video pla yback.</p>
72 <video controls>
73 <track id="testTrack" src="captions-webvtt/cues-overlapping.vtt" kin d="subtitles" onload="loaded()" default>
74 </video>
75 </body>
76 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698