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

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: 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");
11 var timeupdateEventCount = 0;
3 12
4 <video controls></video> 13 video.onerror = t.step_func(function() {});
foolip 2016/07/06 09:22:22 What's the purpose of all of these? Previously the
fs 2016/07/06 09:34:46 EventWatcher could be another way. I think I may h
Srirama 2016/07/06 15:03:45 Removed all these as discussed.
14 video.onloadstart = t.step_func(function() {});
15 video.onwaiting = t.step_func(function() {});
16 video.onratechange = t.step_func(function() {});
17 video.ondurationchange = t.step_func(function() {});
18 video.onloadedmetadata = t.step_func(function() {});
19 video.onloadeddata = t.step_func(function() {});
20 video.oncanplay = t.step_func(function() {});
21 video.onplay = t.step_func(function() {});
22 video.ontimeupdate = t.step_func(function() { ++timeupdateEventCount; });
23 video.onplaying = t.step_func(function() {
24 setTimeout(function() { video.pause(); }, 500) ;
25 });
5 26
6 <p> 27 video.onpause = t.step_func(function() {
7 Test 'timeupdate' events are posted while playing but not while paused. 28 var eventCountOnPause = timeupdateEventCount;
8 </p> 29 setTimeout(t.step_func_done(function() {
9 <script src=media-file.js></script> 30 assert_equals(eventCountOnPause, timeupdateEventCount, "'timeupdate' events posted after pause")
10 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 31 }), 400);
11 (Please avoid writing new tests using video-test.js) --> 32 });
12 <script src=video-test.js></script>
13 <script>
14 setSrcByTagName("video", findMediaFile("video", "content/test"));
15 33
16 var timeupdateEventCount = 0; 34 video.play();
17 var countWhilePlaying = 0; 35 });
18 36 </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