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

Side by Side Diff: third_party/WebKit/LayoutTests/media/video-played-ranges-1.html

Issue 2133223004: Convert video-played* 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 <head> 2 <title>Test media element's "played" attribute and ranges.</title>
3 <title>Test of 'played' attribute</title> 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 <script src="video-played.js"></script>
7 <script src=video-test.js></script> 7 <video></video>
8 <script src=video-played.js></script> 8 <script>
9 <script> 9 var video;
10 async_test(function(t) {
11 video = document.querySelector("video");
10 12
11 var testFunctions = 13 video.onerror = t.step_func(function() {});
12 [ 14 video.onloadstart = t.step_func(function() {});
13 PlayWithNoRanges, 15 video.onratechange = t.step_func(function() {});
14 JumpAndPlayFwd, 16 video.onloadedmetadata = t.step_func(function() {});
15 JumpBackAndPlayToNewRange, 17 video.oncanplay = t.step_func(function() {
16 JumpAndExtendRangeStart, 18 video.oncanplay = null;
17 JumpAndExtendRangeEnd, 19 testRanges();
18 ]; 20 // Test playing when there are no ranges.
21 timeRangeCount = currentTimeRange = 0;
22 startPlayingInNewRange(t);
23 });
24 waitForPauseAndContinue(t, jumpAndPlayFwd, false);
19 25
20 // NOTE: Detailed results are not printed for this test because time values are different from machine 26 function jumpAndPlayFwd() {
21 // to machine and run to run. Commenting out the following line turn s on detailed logging back on, which 27 // Test jumping forward into a new range and play.
22 // can be useful for debugging test failure. 28 video.currentTime = (video.duration - 1.0).toFixed(2);
23 disableFullTestDetailsPrinting(); 29 currentTimeRange = 1;
30 startPlayingInNewRange(t);
31 waitForPauseAndContinue(t, jumpBackAndPlayToNewRange, false);
32 }
24 33
25 function PlayWithNoRanges() 34 function jumpBackAndPlayToNewRange() {
26 { 35 // Test jumping backwards into a new range and play, should insert new r ange.
27 consoleWrite("<br><b><em>Test playing when there are no ranges</ em></b>"); 36 video.currentTime = 3.0;
37 startPlayingInNewRange(t);
38 waitForPauseAndContinue(t, jumpAndExtendRangeStart, false);
39 }
28 40
29 timeRangeCount = currentTimeRange = 0; 41 function jumpAndExtendRangeStart() {
30 willPauseInExistingRange = false; 42 // Test playing into an existing range, should extend range start.
31 willExtendAnExistingRange = false; 43 var newTime = (video.played.start(currentTimeRange) - 0.05).toFixed(2);
44 video.currentTime = newTime;
45 expectedStartTimes[currentTimeRange] = newTime;
46 playForDuration(0.1, t);
47 waitForPauseAndContinue(t, jumpAndExtendRangeEnd, true);
48 }
32 49
33 startPlayingInNewRange(); 50 function jumpAndExtendRangeEnd() {
34 } 51 // Test jumping into an existing range and play beyond end, should exten d range end.
52 var newTime = (video.played.end(currentTimeRange) - 0.05).toFixed(2);
53 video.currentTime = newTime;
54 playForDuration(0.03, t);
55 waitForPauseAndContinue(t, null, true);
56 }
35 57
36 function JumpAndPlayFwd() 58 video.src = findMediaFile("video", "content/test");
37 { 59 });
38 consoleWrite("<br><b><em>Test jumping forward into a new range a nd play</em></b>"); 60 </script>
39
40 var newTime = video.duration - 1.0;
41 runSilently("video.currentTime = " + (newTime.toFixed(2)));
42
43 currentTimeRange = 1;
44 willPauseInExistingRange = false;
45 willExtendAnExistingRange = false;
46
47 startPlayingInNewRange();
48 }
49
50 function JumpBackAndPlayToNewRange()
51 {
52 consoleWrite("<br><b><em>Test jumping backwards into a new range and play, should insert new range</em></b>");
53
54 var newTime = 3.00;
55 runSilently("video.currentTime = " + newTime);
56
57 currentTimeRange = 1;
58 willPauseInExistingRange = false;
59 willExtendAnExistingRange = false;
60
61 startPlayingInNewRange();
62 }
63
64 function JumpAndExtendRangeStart()
65 {
66 consoleWrite("<br><b><em>Test playing into an existing range, sh ould extend range start</em></b>");
67
68 currentTimeRange = 1;
69 var newTime = (video.played.start(currentTimeRange) - 0.05).toFi xed(2);
70 runSilently("video.currentTime = " + newTime);
71
72 expectedStartTimes[currentTimeRange] = newTime;
73 willPauseInExistingRange = true;
74 willExtendAnExistingRange = true;
75 startPlaying();
76 }
77
78 function JumpAndExtendRangeEnd()
79 {
80 consoleWrite("<br><b><em>Test jumping into an existing range and play beyond end, should extend range end</em></b>");
81
82 currentTimeRange = 1;
83
84 var newTime = (video.played.end(currentTimeRange) - 0.05).toFixe d(2);
85 runSilently("video.currentTime = " + newTime);
86
87 willPauseInExistingRange = false;
88 willExtendAnExistingRange = true;
89 playForMillisecs(30);
90 }
91
92 </script>
93 </head>
94
95 <body onload="videoPlayedMain()">
96
97 <video controls></video>
98 <p>Test of the media element 'played' attribute, ranges part 1.</p>
99
100 </body>
101 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698