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

Side by Side Diff: third_party/WebKit/LayoutTests/media/video-seek-past-end-paused.html

Issue 2091973003: Convert video-seek* 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <title>Test that seeking a paused video past its end sets currentTime to duratio n and leaves the video paused.</title>
3 <head> 3 <script src="../resources/testharness.js"></script>
4 <script src=media-file.js></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 5 <script src="media-file.js"></script>
6 (Please avoid writing new tests using video-test.js) --> 6 <video></video>
7 <script src=video-test.js></script> 7 <script>
8 <script> 8 async_test(function(t) {
9 var timeupdateEventCount = 0; 9 var timeupdateEventCount = 0;
10 var video = document.querySelector("video");
11 assert_true(video.paused);
12 assert_false(video.ended);
10 13
11 function doSetup() 14 video.ontimeupdate = t.step_func(function() {
12 { 15 if (++timeupdateEventCount != 2)
13 findMediaElement(); 16 return;
14 waitForEvent('canplaythrough', canPlayThrough);
15 video.src = findMediaFile('video', 'content/test');
16 }
17 window.addEventListener('load', doSetup, false);
18 17
19 function canPlayThrough() 18 // Wait for 2 timeupdate events so we are sure the
20 { 19 // media engine is playing the media.
21 testExpected("video.paused", true); 20 video.ontimeupdate = null;
22 testExpected("video.ended", false); 21 // Make sure time is advancing.
23 video.addEventListener('timeupdate', timeUpdate); 22 assert_false(video.paused);
24 run("video.play()"); 23 assert_greater_than(video.currentTime, 0);
25 } 24 video.onpause = t.step_func(function() {
25 assert_true(video.paused);
26 video.onseeked = t.step_func_done(function() {
27 assert_true(video.paused);
28 assert_equals(video.currentTime, video.duration);
29 assert_true(video.ended);
30 });
26 31
27 function timeUpdate() 32 // Seek past end.
28 { 33 video.currentTime = 500;
29 ++timeupdateEventCount; 34 });
30 35
31 // Wait 2 timeupdate events so we are sure the media engine is 36 video.pause();
32 // playing the media. 37 });
33 if (timeupdateEventCount == 2) {
34 consoleWrite("");
35 video.removeEventListener('timeupdate', timeUpdate);
36 // Make sure time is advancing.
37 testExpected("video.paused", false);
38 testExpected("mediaElement.currentTime", 0, '>');
39 video.addEventListener('pause', paused);
40 video.pause();
41 }
42 }
43 38
44 function paused() { 39 video.src = findMediaFile("video", "content/test");
45 consoleWrite(""); 40 video.play();
46 testExpected("video.paused", true); 41 });
47 video.addEventListener('seeked', seeked); 42 </script>
48 // Seek past end.
49 video.currentTime = 500;
50 };
51
52 function seeked()
53 {
54 consoleWrite("");
55
56 testExpected("video.paused", true);
57 // Don't use "testExpected()" so we won't log the actual duratio n to the
58 // results file, as the floating point result may differ with di fferent engines.
59 reportExpected(mediaElement.currentTime == mediaElement.duration , "mediaElement.currentTime", "==", "mediaElement.duration", mediaElement.curren tTime);
60
61 testExpected("video.ended", true);
62 consoleWrite("");
63 timeupdateEventCount = 0;
64 endTest();
65 }
66 </script>
67 </head>
68 <body>
69 <video controls></video>
70 <p>Test that seeking a paused video past its end sets currentTime to dur ation and leaves the video paused.</p>
71 </body>
72 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698