Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 """Basic playback test. Checks playback, seek, and replay based on events. | |
| 7 | |
| 8 This test uses the bear videos from the test matrix in h264, vp8, and theora | |
| 9 formats. | |
| 10 """ | |
| 11 import logging | |
| 12 import os | |
| 13 | |
| 14 import pyauto_media | |
| 15 | |
| 16 | |
| 17 # HTML test path; relative to src/chrome/test/data. | |
| 18 _TEST_HTML_PATH = os.path.join('media', 'html', 'media_basic_playback.html') | |
| 19 | |
| 20 | |
| 21 class MediaConstrainedNetworkPerfTest(pyauto_media.MediaTestBase): | |
| 22 """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.
| |
| 23 | |
| 24 def testBasicPlaybackMatrix(self): | |
| 25 """Launches HTML test which plays a video until end, seeks, and replays. | |
| 26 | |
| 27 Specifically ensures that after the above sequence of events, the following | |
| 28 is true: | |
| 29 | |
| 30 1. 2x playing, 2x ended, 1x seeked, 0x error, and 0x abort events. | |
| 31 2. video.currentTime == video.duration. | |
| 32 """ | |
| 33 # 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.
| |
| 34 media_files = self.FindMedia(name='bear', video=True) | |
| 35 for media in media_files: | |
| 36 logging.debug('Running basic playback test for %s', media) | |
| 37 | |
| 38 self.NavigateToURL('%s?media=%s' % ( | |
| 39 self.GetFileURLForDataPath(_TEST_HTML_PATH), media)) | |
| 40 | |
| 41 # Block until the test finishes and notifies us. Upon return the value of | |
| 42 # video.currentTime == video.duration is provided. | |
| 43 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
| |
| 44 | |
| 45 events = self.GetDOMValue('events').split(',') | |
| 46 counts = [(item, events.count(item)) for item in sorted(set(events))] | |
| 47 self.assertEqual(counts, [('ended', 2), ('playing', 2), ('seeked', 1)]) | |
| 48 | |
| 49 | |
| 50 if __name__ == '__main__': | |
| 51 pyauto_media.Main() | |
| OLD | NEW |