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

Side by Side Diff: third_party/WebKit/LayoutTests/media/video-timeupdate-during-playback.html

Issue 2126753002: Convert video-[default, size, timeupdate]* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 5 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 <html> 1 <!DOCTYPE html>
2 <body> 2 <title>Test "timeupdate" events are posted while playing but not while paused.</ title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="media-file.js"></script>
6 <video></video>
7 <script>
8 async_test(function(t) {
9 var video = document.querySelector("video");
10 video.src = findMediaFile("video", "content/test");
3 11
4 <video controls></video> 12 video.onplaying = t.step_func(function() {
13 video.ontimeupdate = t.step_func(function() {
14 video.pause();
15 });
16 });
5 17
6 <p> 18 video.onpause = t.step_func(function() {
7 Test 'timeupdate' events are posted while playing but not while paused. 19 video.ontimeupdate = t.unreached_func();
8 </p> 20 setTimeout(t.step_func_done(), 250);
9 <script src=media-file.js></script> 21 });
10 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
11 (Please avoid writing new tests using video-test.js) -->
12 <script src=video-test.js></script>
13 <script>
14 setSrcByTagName("video", findMediaFile("video", "content/test"));
15 22
16 var timeupdateEventCount = 0; 23 video.play();
17 var countWhilePlaying = 0; 24 });
18 25 </script>
19 function someTimeLater()
20 {
21 if (countWhilePlaying != timeupdateEventCount)
22 failTest("'timeupdate' events posted after pausing");
23 endTest();
24 }
25
26 function pause()
27 {
28 countWhilePlaying = timeupdateEventCount;
29 setTimeout(someTimeLater, 400) ;
30 consoleWrite("");
31 }
32
33 function playing()
34 {
35 setTimeout(function () { run("video.pause()"); }, 500) ;
36 consoleWrite("");
37 }
38
39 mediaElement.addEventListener("timeupdate", function () { ++timeupdateEv entCount; });
40
41 waitForEvent('error');
42 waitForEvent("loadstart");
43 waitForEvent("waiting");
44 waitForEvent("ratechange");
45 waitForEvent("durationchange");
46 waitForEvent("loadedmetadata");
47 waitForEvent("loadeddata");
48 waitForEvent("canplay");
49 waitForEvent("pause", pause);
50 waitForEvent("play");
51 waitForEvent("playing", playing);
52
53 run("video.play()");
54 consoleWrite("");
55 </script>
56
57 </body>
58 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698