Chromium Code Reviews| Index: chrome/test/functional/media/media_basic_playback.py |
| diff --git a/chrome/test/functional/media/media_basic_playback.py b/chrome/test/functional/media/media_basic_playback.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..a0903285ba8c30c5ea1eb42441d4acedc14bb787 |
| --- /dev/null |
| +++ b/chrome/test/functional/media/media_basic_playback.py |
| @@ -0,0 +1,56 @@ |
| +#!/usr/bin/env python |
| +# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +"""Basic playback test. Checks playback, seek, and replay based on events. |
| + |
| +This test uses the bear videos from the test matrix in h264, vp8, and theora |
| +formats. |
| +""" |
| +import logging |
| +import os |
| + |
| +import pyauto_media |
| +import pyauto |
| + |
| + |
| +# HTML test path; relative to src/chrome/test/data. |
| +_TEST_HTML_PATH = os.path.join('media', 'html', 'media_basic_playback.html') |
| + |
| +# Test videos to play. TODO(dalecurtis): Convert to text matrix parser when we |
| +# have more test videos in the matrix. Code already written, ping for details. |
|
Ami GONE FROM CHROMIUM
2012/01/26 21:40:05
...or you could point to the PS#3 of this CR :)
DaleCurtis
2012/01/26 22:11:36
Done.
|
| +_TEST_VIDEOS = [ |
| + 'bear.mp4', 'bear.ogv', 'bear.webm', 'bear_silent.mp4', 'bear_silent.ogv', |
| + 'bear_silent.webm'] |
| + |
| + |
| +class MediaConstrainedNetworkPerfTest(pyauto.PyUITest): |
| + """PyAuto test container. See file doc string for more information.""" |
| + |
| + def testBasicPlaybackMatrix(self): |
| + """Launches HTML test which plays a video until end, seeks, and replays. |
| + |
| + Specifically ensures that after the above sequence of events, the following |
| + is true: |
| + |
| + 1. 2x playing, 2x ended, 1x seeked, 0x error, and 0x abort events. |
| + 2. video.currentTime == video.duration. |
| + """ |
| + for media in _TEST_VIDEOS: |
| + logging.debug('Running basic playback test for %s', media) |
| + |
| + self.NavigateToURL('%s?media=%s' % ( |
| + self.GetFileURLForDataPath(_TEST_HTML_PATH), media)) |
| + |
| + # Block until the test finishes and notifies us. Upon return the value of |
| + # video.currentTime == video.duration is provided. |
| + self.assertTrue(self.ExecuteJavascript('true;')) |
| + |
| + events = self.GetDOMValue('events').split(',') |
| + counts = [(item, events.count(item)) for item in sorted(set(events))] |
| + self.assertEqual(counts, [('ended', 2), ('playing', 2), ('seeked', 1)]) |
| + |
| + |
| +if __name__ == '__main__': |
| + pyauto_media.Main() |