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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/track-cues-pause-on-exit.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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/track-cues-pause-on-exit-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <title>Tests that the video is paused after cues that have pause-on-exit flag ar e processed.</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 controls>
7 <track src="captions-webvtt/simple-captions.vtt" 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, 4);
15 for (var i = 0; i < track.track.cues.length; ++i) {
16 var cue = track.track.cues[i];
17 if (i % 2 == 0) {
18 cue.pauseOnExit = true;
19 cue.onexit = t.step_func(function(event) {
20 assert_true(video.paused);
5 21
6 <script src=../media-file.js></script> 22 video.play();
7 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
8 (Please avoid writing new tests using video-test.js) -->
9 <script src=../video-test.js></script>
10 <script>
11 var videoCanPlayThrough = false;
12 var trackLoaded = false;
13 23
14 var currentCue; 24 if (event.target.id == 2)
15 var currentCueNumber = 0; 25 t.done();
16
17 function runTests()
18 {
19 if (!trackLoaded || !videoCanPlayThrough)
20 return;
21
22 testTrack = document.getElementById("testTrack");
23 testExpected("testTrack.track.cues.length", 4);
24
25 consoleWrite("");
26
27 for (var i = 0; i < testTrack.track.cues.length; ++i) {
28 testTrack.track.cues[i].pauseOnExit = (i % 2 == 0);
29 }
30
31 run("video.play()");
32 testExpected("video.paused", false);
33 consoleWrite("");
34
35 waitForEvent('pause', function() {
36 waitForEvent('exit', cueExited, false, true, testTrack.track .cues[currentCueNumber]);
37 }); 26 });
38 } 27 }
39 28 }
40 function cueExited(evt) 29 video.src = findMediaFile("video", "../content/test");
41 { 30 video.currentTime = 4.00;
42 currentCue = evt.target; 31 video.play();
43 32 assert_false(video.paused);
44 33 });
45 testExpected("currentCue.id", currentCueNumber); 34 });
46 testExpected("video.paused", true); 35 </script>
47
48 run("video.play()");
49
50 if (currentCueNumber == 2)
51 endTest();
52
53 currentCueNumber += 2;
54
55 consoleWrite("");
56 }
57
58 function loaded()
59 {
60 trackLoaded = true;
61
62 runTests();
63 }
64
65 function bodyLoaded()
66 {
67 findMediaElement();
68 video.src = findMediaFile("video", "../content/test");
69 }
70
71 waitForEventOnce('canplaythrough', function() {
72 video.currentTime = 4.00;
73 videoCanPlayThrough = true;
74
75 runTests();
76 });
77
78 </script>
79 </head>
80 <body onload="bodyLoaded()">
81 <p>Tests that the video is paused after cues that have pause-on-exit fla g are processed</p>
82 <video controls>
83 <track id="testTrack" src="captions-webvtt/simple-captions.vtt" onlo ad="loaded()" default>
84 </video>
85 </body>
86 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/track-cues-pause-on-exit-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698