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

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

Issue 1715303002: Add TODOs to convert from video-test.js to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add bug ref Created 4 years, 10 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 <html>
2 <head> 2 <head>
3 <title>Test of 'played' attribute</title> 3 <title>Test of 'played' attribute</title>
4 <script src=media-file.js></script> 4 <script src=media-file.js></script>
5 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956
6 (Please avoid writing new tests using video-test.js) -->
5 <script src=video-test.js></script> 7 <script src=video-test.js></script>
6 <script src=video-played.js></script> 8 <script src=video-played.js></script>
7 <script> 9 <script>
8 10
9 var testFunctions = 11 var testFunctions =
10 [ 12 [
11 PlayWithNoRanges, 13 PlayWithNoRanges,
12 CreateANewRange, 14 CreateANewRange,
13 JumpAndCollapseTwoRanges, 15 JumpAndCollapseTwoRanges,
14 TestLoopingAndPassToTheEnd 16 TestLoopingAndPassToTheEnd
15 ]; 17 ];
16 18
17 // NOTE: Result details are not printed for this test because time v alues are different from machine 19 // NOTE: Result details are not printed for this test because time v alues are different from machine
18 // to machine and run to run. Commenting out the following line turn s on detailed logging back on, which 20 // to machine and run to run. Commenting out the following line turn s on detailed logging back on, which
19 // can be useful for debugging test failure. 21 // can be useful for debugging test failure.
20 disableFullTestDetailsPrinting(); 22 disableFullTestDetailsPrinting();
21 23
22 function PlayWithNoRanges() 24 function PlayWithNoRanges()
23 { 25 {
24 consoleWrite("<br><b><em>Test playing when there are no ranges</ em></b>"); 26 consoleWrite("<br><b><em>Test playing when there are no ranges</ em></b>");
25 27
26 willPauseInExistingRange = false; 28 willPauseInExistingRange = false;
27 willExtendAnExistingRange = false; 29 willExtendAnExistingRange = false;
28 timeRangeCount = currentTimeRange = 0; 30 timeRangeCount = currentTimeRange = 0;
29 31
30 runSilently("video.currentTime = 0.5"); 32 runSilently("video.currentTime = 0.5");
31 33
32 currentTimeRange++; 34 currentTimeRange++;
33 startPlayingInNewRange(); 35 startPlayingInNewRange();
34 } 36 }
35 37
36 38
37 function CreateANewRange() 39 function CreateANewRange()
38 { 40 {
39 consoleWrite("<br><b><em>Create a new range</em></b>"); 41 consoleWrite("<br><b><em>Create a new range</em></b>");
40 42
41 var newTime = (video.played.end(0) + 0.05).toFixed(2); 43 var newTime = (video.played.end(0) + 0.05).toFixed(2);
42 runSilently("video.currentTime = " + newTime); 44 runSilently("video.currentTime = " + newTime);
43 45
44 willPauseInExistingRange = false; 46 willPauseInExistingRange = false;
45 willExtendAnExistingRange = false; 47 willExtendAnExistingRange = false;
46 48
47 startPlayingInNewRange(); 49 startPlayingInNewRange();
48 } 50 }
49 51
50 function JumpAndCollapseTwoRanges() 52 function JumpAndCollapseTwoRanges()
51 { 53 {
52 consoleWrite("<br><b><em>Test playing from one range into anothe r, should collapse the two ranges</em></b>"); 54 consoleWrite("<br><b><em>Test playing from one range into anothe r, should collapse the two ranges</em></b>");
53 55
54 timeRangeCount--; 56 timeRangeCount--;
55 currentTimeRange = timeRangeCount - 1; 57 currentTimeRange = timeRangeCount - 1;
56 var startTime = expectedStartTimes[0] - 0.1; 58 var startTime = expectedStartTimes[0] - 0.1;
57 expectedStartTimes[0] = startTime; 59 expectedStartTimes[0] = startTime;
58 expectedEndTimes[0] = expectedEndTimes[1]; 60 expectedEndTimes[0] = expectedEndTimes[1];
59 61
60 willPauseInExistingRange = false; 62 willPauseInExistingRange = false;
61 willExtendAnExistingRange = false; 63 willExtendAnExistingRange = false;
62 runSilently("video.currentTime = " + startTime); 64 runSilently("video.currentTime = " + startTime);
63 65
64 playForMillisecs(secToMilli(expectedEndTimes[1] - startTime + 0. 1)); // Triggers pause() 66 playForMillisecs(secToMilli(expectedEndTimes[1] - startTime + 0. 1)); // Triggers pause()
65 } 67 }
66 68
67 function TestLoopingAndPassToTheEnd() 69 function TestLoopingAndPassToTheEnd()
68 { 70 {
69 consoleWrite("<br><b><em>Test looping</em></b>"); 71 consoleWrite("<br><b><em>Test looping</em></b>");
70 72
71 // Start playing near the end of the movie so it will loop quick ly. 73 // Start playing near the end of the movie so it will loop quick ly.
72 run("video.loop = true"); 74 run("video.loop = true");
73 var startTime = (video.duration - 0.05).toFixed(2); 75 var startTime = (video.duration - 0.05).toFixed(2);
74 runSilently("video.currentTime = " + startTime); 76 runSilently("video.currentTime = " + startTime);
75 77
76 // We will end in the very first time range 78 // We will end in the very first time range
77 currentTimeRange = 0; 79 currentTimeRange = 0;
78 80
79 willPauseInExistingRange = true; 81 willPauseInExistingRange = true;
80 willExtendAnExistingRange = true; 82 willExtendAnExistingRange = true;
81 83
82 // Playing from near the end so we will create a new time range from startTime .. duration 84 // Playing from near the end so we will create a new time range from startTime .. duration
83 timeRangeCount++; 85 timeRangeCount++;
84 expectedStartTimes[timeRangeCount-1] = startTime; 86 expectedStartTimes[timeRangeCount-1] = startTime;
85 expectedEndTimes[timeRangeCount-1] = video.duration.toFixed(2); 87 expectedEndTimes[timeRangeCount-1] = video.duration.toFixed(2);
86 88
87 // Have to play for long enough to loop and play into the existi ng range. 89 // Have to play for long enough to loop and play into the existi ng range.
88 var playDuration = 1.25; 90 var playDuration = 1.25;
89 91
90 // Playback restarts from beginning, so expect the beginning of first time range to be 0. 92 // Playback restarts from beginning, so expect the beginning of first time range to be 0.
91 expectedStartTimes[0] = 0; 93 expectedStartTimes[0] = 0;
92 playForMillisecs(secToMilli(playDuration)); // Triggers pause() 94 playForMillisecs(secToMilli(playDuration)); // Triggers pause()
93 } 95 }
94 96
95 </script> 97 </script>
96 </head> 98 </head>
97 99
98 <body onload="videoPlayedMain()"> 100 <body onload="videoPlayedMain()">
99 101
100 <video controls></video> 102 <video controls></video>
101 <p>Test of the media element 'played' attribute</p> 103 <p>Test of the media element 'played' attribute</p>
102 104
103 </body> 105 </body>
104 </html> 106 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698