Index: chrome/test/data/media/html/media_basic_playback.html |
diff --git a/chrome/test/data/media/html/media_basic_playback.html b/chrome/test/data/media/html/media_basic_playback.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..767e238d800c42c1dfb48708a0499d66984e437c |
--- /dev/null |
+++ b/chrome/test/data/media/html/media_basic_playback.html |
@@ -0,0 +1,51 @@ |
+<!-- Used by media_basic_playback to verify basic playback. --> |
+<!DOCTYPE html> |
+<html lang="en-US"> |
+ <head> |
+ <title>Basic Media Playback Test</title> |
+ </head> |
+ |
+ <body> |
+ <video autoplay preload controls/> |
+ </body> |
+ |
+ <script type="text/javascript" src="utils.js"></script> |
+ <script type="text/javascript"> |
+ var video = document.querySelector('video'); |
+ |
+ // Used to keep track of events. |
+ var events = [] |
+ |
+ video.addEventListener('ended', function(event) { |
+ // At the end of the first playback, seek near end and replay. |
+ if (events.indexOf('ended') < 0) { |
+ video.currentTime = 0.8 * video.duration; |
+ video.play(); |
+ logEvent(event); |
Ami GONE FROM CHROMIUM
2012/01/25 17:58:48
Log the event *first*, which both removes doubts a
DaleCurtis
2012/01/25 23:59:25
Done.
|
+ } else { |
+ logEvent(event); |
+ |
+ // PyAuto has trouble with arrays, so convert to string. |
+ events = events.join(','); |
shadi
2012/01/25 19:30:04
How would PyAuto read "events" if some error occur
DaleCurtis
2012/01/25 23:59:25
It will time out and fail.
|
+ |
+ // Notify PyAuto that we've completed testing. Send test of currenTime |
Ami GONE FROM CHROMIUM
2012/01/25 17:58:48
s/nT/ntT/
DaleCurtis
2012/01/25 23:59:25
Done.
|
+ // at the same time for efficiency. |
+ window.domAutomationController.send( |
+ video.currentTime == video.duration); |
Ami GONE FROM CHROMIUM
2012/01/25 17:58:48
What happens if this fails?
DaleCurtis
2012/01/25 23:59:25
You mean the equality statement? The PyAuto portio
|
+ } |
+ }, false); |
+ |
+ video.addEventListener('playing', logEvent, false); |
+ video.addEventListener('error', logEvent, false); |
+ video.addEventListener('abort', logEvent, false); |
+ video.addEventListener('seeked', logEvent, false); |
+ |
+ function logEvent(evt) { |
Ami GONE FROM CHROMIUM
2012/01/25 17:58:48
Move this above the text that uses it.
DaleCurtis
2012/01/25 23:59:25
Done.
|
+ events.push(evt.type) |
+ } |
+ |
+ // Retrieve video file name from URL query parameters. See utils.js. |
+ video.src = '../' + QueryString.media; |
+ video.play() |
+ </script> |
+</html> |