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

Side by Side Diff: chrome/test/data/media/html/media_basic_playback.html

Issue 9233046: Bug fixes for basic playback test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review fixes. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/test/functional/media/media_basic_playback.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!-- Used by media_basic_playback to verify basic playback. --> 1 <!-- Used by media_basic_playback to verify basic playback. -->
2 <!DOCTYPE html> 2 <!DOCTYPE html>
3 <html lang="en-US"> 3 <html lang="en-US">
4 <head> 4 <head>
5 <title>Basic Media Playback Test</title> 5 <title>Basic Media Playback Test</title>
6 </head> 6 </head>
7 7
8 <body> 8 <body>
9 <video autoplay preload controls></video> 9 <video autoplay preload controls></video>
10 </body> 10 </body>
11 11
12 <script type="text/javascript" src="utils.js"></script> 12 <script type="text/javascript" src="utils.js"></script>
13 <script type="text/javascript"> 13 <script type="text/javascript">
14 var video = document.querySelector('video'); 14 var video = document.querySelector('video');
15 15
16 // Used to keep track of events. 16 // Used to keep track of events.
17 var events = []; 17 var events;
18
19 // List of events to log. Events in this list are those which are expected
20 // plus those which are unexpected and will have a negative impact on
21 // playback.
22 var eventsToLog = [
23 'abort', 'emptied', 'error', 'playing', 'stalled', 'suspend', 'waiting'];
18 24
19 function logEvent(evt) { 25 function logEvent(evt) {
20 events.push(evt.type); 26 events.push(evt.type);
21 } 27 }
22 28
29 for(var i = 0; i < eventsToLog.length; i++)
30 video.addEventListener(eventsToLog[i], logEvent, false);
31
23 video.addEventListener('ended', function(event) { 32 video.addEventListener('ended', function(event) {
24 firstEndedEvent = events.indexOf('ended') < 0; 33 firstEndedEvent = events.indexOf('ended') < 0;
25 logEvent(event); 34 logEvent(event);
26 35
27 // At the end of the first playback, seek near end and replay. 36 // At the end of the first playback, seek near end and replay. 0.8 was
37 // chosen arbitrarily.
28 if (firstEndedEvent) { 38 if (firstEndedEvent) {
29 video.currentTime = 0.8 * video.duration; 39 video.currentTime = 0.8 * video.duration;
30 video.play();
31 } else { 40 } else {
32 // PyAuto has trouble with arrays, so convert to string.
33 events = events.join(',');
34
35 // Notify PyAuto that we've completed testing. Send test of currentTime 41 // Notify PyAuto that we've completed testing. Send test of currentTime
36 // at the same time for efficiency. 42 // at the same time for efficiency.
37 window.domAutomationController.send( 43 window.domAutomationController.send(
38 video.currentTime == video.duration); 44 video.currentTime == video.duration);
39 } 45 }
40 }, false); 46 }, false);
41 47
42 video.addEventListener('playing', logEvent, false); 48 video.addEventListener('seeked', function(event) {
43 video.addEventListener('error', logEvent, false); 49 logEvent(event);
44 video.addEventListener('abort', logEvent, false); 50 video.play();
45 video.addEventListener('seeked', logEvent, false); 51 }, false);
46 52
47 // Retrieve video file name from URL query parameters. See utils.js. 53 function startTest(media) {
48 video.src = '../' + QueryString.media; 54 events = [];
49 video.play(); 55 video.src = '../' + media;
56 }
50 </script> 57 </script>
51 </html> 58 </html>
OLDNEW
« no previous file with comments | « no previous file | chrome/test/functional/media/media_basic_playback.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698