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..8f08c0022ec9a6f34cc4071edfd99991be5980cc |
| --- /dev/null |
| +++ b/chrome/test/functional/media/media_basic_playback.py |
| @@ -0,0 +1,51 @@ |
| +#!/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 |
| + |
| + |
| +# HTML test path; relative to src/chrome/test/data. |
| +_TEST_HTML_PATH = os.path.join('media', 'html', 'media_basic_playback.html') |
| + |
| + |
| +class MediaConstrainedNetworkPerfTest(pyauto_media.MediaTestBase): |
| + """PyAuto test container. See file doc string for more information.""" |
|
Ami GONE FROM CHROMIUM
2012/01/25 17:58:48
Does this comment buy anything?
DaleCurtis
2012/01/25 23:59:25
Just keeps gpylint from complaining.
|
| + |
| + 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. |
| + """ |
| + # Find all bear media w/o video. |
|
Ami GONE FROM CHROMIUM
2012/01/25 17:58:48
Wat?
DaleCurtis
2012/01/25 23:59:25
Done.
|
| + media_files = self.FindMedia(name='bear', video=True) |
| + for media in media_files: |
| + 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;')) |
|
shadi
2012/01/25 19:30:04
Does this wait for the test to end? (I am just fam
DaleCurtis
2012/01/25 23:59:25
Yes, the normal PyAuto automation call timeout app
|
| + |
| + 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() |