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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/media/video-seek-to-duration.html

Issue 2177793003: Convert video-seek* and video-served* http tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/http/tests/media/video-seek-to-duration-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 <html> 1 <!DOCTYPE html>
2 <head> 2 <title>Test event dispatches and attribute changes for seek to duration.</title>
3 <script src=../../media-resources/media-file.js></script> 3 <script src="../resources/testharness.js"></script>
4 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 4 <script src="../resources/testharnessreport.js"></script>
5 (Please avoid writing new tests using video-test.js) --> 5 <script src="../../media-resources/media-file.js"></script>
6 <script src=../../media-resources/video-test.js></script> 6 <video></video>
7 <script> 7 <script>
8 function start() 8 async_test(function(t) {
9 { 9 var video = document.querySelector("video");
10 findMediaElement();
11 10
12 waitForEvent('durationchange'); 11 var watcher = new EventWatcher(t, video, ["durationchange", "loadedmetadata" ,
13 waitForEvent('loadedmetadata'); 12 "loadeddata", "seeking", "timeupdate", "seeked", "pause", "ended"]);
14 waitForEventOnce('loadeddata', function ()
15 {
16 waitForEvent('seeking', function ()
17 {
18 testExpected('video.seeking', true, '==');
19 testExpected('video.ended', true, '==');
20 testExpected('video.currentTime == video.duration', true , '==');
21 testExpected('video.paused', false, '==');
22 13
23 waitForEventOnce('timeupdate', function() 14 watcher.wait_for(["durationchange", "loadedmetadata", "loadeddata"]).then(t. step_func(function() {
24 { 15 // Seek to the duration of the media.
25 testExpected('video.seeking', false, '=='); 16 assert_less_than(video.currentTime, video.duration);
26 testExpected('video.ended', true, '=='); 17 assert_false(video.ended)
27 testExpected('video.currentTime == video.duration', true, '=='); 18 assert_false(video.paused);
28 }); 19 //Starting seek to duration by setting video.currentTime to video.durati on.
29 }); 20 video.currentTime = video.duration;
21 testCommonAttributes(true);
22 return watcher.wait_for("seeking");
23 })).then(t.step_func(function() {
24 testCommonAttributes(true);
25 assert_false(video.paused);
26 return watcher.wait_for("timeupdate");
27 })).then(t.step_func(function() {
28 testCommonAttributes(false);
29 return watcher.wait_for("seeked");
30 })).then(t.step_func(function() {
31 testCommonAttributes(false);
32 return watcher.wait_for("timeupdate");
Srirama 2016/07/25 11:05:06 Added this extra "timeupdate" event so that we wil
fs 2016/07/25 15:17:59 Acknowledged.
33 })).then(t.step_func(function() {
34 testCommonAttributes(false);
35 return watcher.wait_for("pause");
36 })).then(t.step_func(function() {
37 assert_true(video.paused);
38 testCommonAttributes(false);
39 return watcher.wait_for("ended");
40 })).then(t.step_func_done(function() {
41 testCommonAttributes(false);
42 assert_true(video.paused);
43 }));
30 44
31 waitForEvent('seeked', function () 45 function testCommonAttributes(seekingExpected) {
32 { 46 assert_equals(video.seeking, seekingExpected);
33 testExpected('video.seeking', false, '=='); 47 assert_true(video.ended);
34 testExpected('video.ended', true, '=='); 48 assert_equals(video.currentTime, video.duration);
35 testExpected('video.currentTime == video.duration', true , '=='); 49 }
36 50
37 }); 51 video.src = findMediaFile("video", "resources/test");;
38 52 video.play();
39 waitForEvent('pause', function() 53 });
40 { 54 </script>
41 testExpected('video.paused', true, '==');
42 testExpected('video.seeking', false, '==');
43 testExpected('video.ended', true, '==');
44 testExpected('video.currentTime == video.duration', true , '==');
45 });
46
47 waitForEvent('ended', function ()
48 {
49 testExpected('video.seeking', false, '==');
50 testExpected('video.ended', true, '==');
51 testExpected('video.paused', true, '==');
52 testExpected('video.currentTime == video.duration', true , '==');
53 endTest();
54 });
55
56 // Seek to the duration of the media
57 testExpected('video.currentTime < video.duration', true, '== ');
58 testExpected('video.ended', false, '==');
59 testExpected('video.paused', false, '==');
60 consoleWrite('Starting seek to duration by setting video.cur rentTime to video.duration');
61 video.currentTime = video.duration;
62 testExpected('video.currentTime == video.duration', true, '= =');
63 testExpected('video.seeking', true, '==');
64 testExpected('video.ended', true, '==');
65 });
66
67 var mediaFile = findMediaFile('video', 'resources/test');
68 video.src = '/' + mediaFile;
69 run('video.play()');
70 }
71 </script>
72 </head>
73 <body onload="start()">
74 <video></video>
75 <p>Test event dispatches and attribute changes for seek to duration</p>
76 </body>
77 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/media/video-seek-to-duration-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698