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

Side by Side Diff: third_party/WebKit/LayoutTests/media/video-buffered-unknown-duration.html

Issue 2060353005: Convert video-autoplay*, video-black* and video-buffered* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nit Created 4 years, 6 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>Load a video with an infinite duration. Start playback and ensure video.c urrentTime is less than video.buffered.end(0) upon first timeupdate.</title>
3 <body onload="start()"> 3 <script src="../resources/testharness.js"></script>
4 <p>Load a video with an infinite duration. Start playback and ensure 4 <script src="../resources/testharnessreport.js"></script>
5 video.currentTime &lt; video.buffered.end(0) upon first timeupdate.</p> 5 <script src="media-file.js"></script>
6 <video></video> 6 <video></video>
7 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
8 (Please avoid writing new tests using video-test.js) -->
9 <script src="video-test.js"></script>
10 <script src="media-file.js"></script>
11 <script> 7 <script>
12 waitForEventOnce('timeupdate', function() { 8 async_test(function(t) {
9 var video = document.querySelector("video");
10
11 video.ontimeupdate = t.step_func_done(function() {
12 video.ontimeupdate = null;
13 video.pause(); 13 video.pause();
14 14
15 testExpected('video.duration', Infinity, '=='); 15 assert_equals(video.duration, Infinity);
16 testExpected('video.buffered.start(0)', 0, '>='); 16 assert_greater_than_equal(video.buffered.start(0), 0);
17 17
18 // 10 seconds chosen arbitrarily as it's larger than the duration, but 18 // 10 seconds chosen arbitrarily as it's larger than the duration, but
19 // small enough to test for overflow of arithmetic performed on the 19 // small enough to test for overflow of arithmetic performed on the
20 // infinite duration. 20 // infinite duration.
21 testExpected('video.buffered.end(0)', 10, '<'); 21 assert_less_than(video.buffered.end(0), 10);
22 test('video.currentTime <= video.buffered.end(0)'); 22 assert_less_than_equal(video.currentTime, video.buffered.end(0));
23 endTest();
24 }); 23 });
25 24
26 waitForEventOnce('loadeddata', function() { 25 video.onloadeddata = t.step_func(function() {
27 testExpected('video.buffered.length', 1, '=='); 26 video.onloadeddata = null;
28 testExpected('video.buffered.start(0)', 0, '>='); 27 assert_equals(video.buffered.length, 1);
29 testExpected('video.buffered.end(0)', Infinity, '!='); 28 assert_greater_than_equal(video.buffered.start(0), 0);
30 testExpected('video.currentTime', 0, '=='); 29 assert_not_equals(video.buffered.end(0), Infinity);
31 testExpected('video.duration', Infinity, '=='); 30 assert_equals(video.currentTime, 0);
31 assert_equals(video.duration, Infinity);
32 video.play(); 32 video.play();
33 }); 33 });
34 34
35 function start() { 35 video.src = "resources/test-live.webm";
36 video.src = 'resources/test-live.webm'; 36 });
37 } 37 </script>
38 </script>
39 </body>
40 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698