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

Side by Side Diff: third_party/WebKit/LayoutTests/media/video-seek-to-duration-with-playbackrate-zero.html

Issue 2100703003: Convert video-seek* 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 <!doctype html> 1 <!DOCTYPE html>
2 <html> 2 <title>Test behavior when seeking to the duration and the playback rate equals 0 .</title>
3 <head> 3 <script src="../resources/testharness.js"></script>
4 <title>Test behavior when seeking to the duration and the playback rate equals 0.</title> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src="media-file.js"></script> 5 <script src="media-file.js"></script>
6 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 6 <video></video>
7 (Please avoid writing new tests using video-test.js) --> 7 <script>
8 <script src="video-test.js"></script> 8 async_test(function(t) {
9 var video = document.querySelector("video");
9 10
10 <script> 11 video.src = findMediaFile("video", "content/test");
11 function onLoad() 12 video.load();
12 { 13 video.onseeking = t.step_func(function() {});
13 findMediaElement();
14 video.src = findMediaFile("video", "content/test");
15 video.load();
16 waitForEvent("seeking");
17 14
18 waitForEventOnce("loadedmetadata", function() 15 video.onloadedmetadata = t.step_func(function() {
19 { 16 video.onloadedmetadata = null;
20 consoleWrite("Seeking to duration"); 17 video.currentTime = video.duration;
21 video.currentTime = video.duration; 18 video.playbackRate = 0;
22 video.playbackRate = 0; 19 video.onended = t.step_func(function() {
23 waitForEventOnce("seeked"); 20 assert_equals(video.currentTime, video.duration);
24 waitForEventOnce("ended", firstEnded); 21 // Seeking to the middle of the video.
25 }); 22 video.currentTime = video.duration / 2;
26 23 video.onseeked = t.step_func(function() {
27 function firstEnded() 24 // Setting loop to true and seeking to duration.
28 { 25 video.loop = true;
29 testExpected("video.currentTime == video.duration", true); 26 video.currentTime = video.duration;
30 consoleWrite("Seeking to the middle of the video"); 27 video.onseeked = t.step_func(function() {
31 video.currentTime = video.duration / 2; 28 // Seek to duration completed. Waiting for a seek to the beg inning.
32 waitForEventOnce("seeked", seekToMiddleDone); 29 video.onseeked = t.step_func_done(function() {
33 } 30 assert_equals(video.currentTime, 0);
34 31 });
35 function seekToMiddleDone() 32 });
36 { 33 });
37 consoleWrite("Setting loop to true and seeking to duration."); 34 });
38 video.loop = true; 35 });
39 video.currentTime = video.duration; 36 });
40 waitForEventOnce("seeked", seekToDurationComplete); 37 </script>
41 }
42
43 function seekToDurationComplete()
44 {
45 consoleWrite("Seek to duration completed. Waiting for a seek t o the beginning.");
46 waitForEventOnce("seeked", seekToBeginningComplete);
47 }
48
49 function seekToBeginningComplete()
50 {
51 testExpected("video.currentTime", 0);
52 endTest();
53 }
54 }
55 </script>
56 </head>
57 <body onload="onLoad()">
58 <video id="v" preload="metadata"></video>
59 </body>
60 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698