OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Basic playback test. Checks playback, seek, and replay based on events. | 6 """Basic playback test. Checks playback, seek, and replay based on events. |
7 | 7 |
8 This test uses the bear videos from the test matrix in h264, vp8, and theora | 8 This test uses the bear videos from the test matrix in h264, vp8, and theora |
9 formats. | 9 formats. |
10 """ | 10 """ |
11 import logging | 11 import logging |
12 import os | 12 import os |
13 | 13 |
14 import pyauto_media | 14 import pyauto_media |
15 import pyauto | 15 import pyauto |
16 | 16 |
17 | 17 |
18 # HTML test path; relative to src/chrome/test/data. | 18 # HTML test path; relative to src/chrome/test/data. |
19 _TEST_HTML_PATH = os.path.join('media', 'html', 'media_basic_playback.html') | 19 _TEST_HTML_PATH = os.path.join('media', 'html', 'media_basic_playback.html') |
20 | 20 |
21 # Test videos to play. TODO(dalecurtis): Convert to text matrix parser when we | 21 # Test videos to play. TODO(dalecurtis): Convert to text matrix parser when we |
22 # have more test videos in the matrix. Code already written, see patch here: | 22 # have more test videos in the matrix. Code already written, see patch here: |
23 # https://chromiumcodereview.appspot.com/9290008/#ps12 | 23 # https://chromiumcodereview.appspot.com/9290008/#ps12 |
24 _TEST_VIDEOS = [ | 24 _TEST_VIDEOS = [ |
25 'bear.mp4', 'bear.ogv', 'bear.webm', 'bear_silent.mp4', 'bear_silent.ogv', | 25 os.path.join(pyauto.PyUITest.ContentDataDir(), 'media', name) |
DaleCurtis
2012/07/26 17:49:52
'/'.join() or posixpath() ? :)
shadi
2012/07/26 17:55:31
I believe os.path.join is what we need here since
| |
26 'bear_silent.webm'] | 26 for name in ['bear.mp4', 'bear.ogv', 'bear.webm', 'bear_silent.mp4', |
27 'bear_silent.ogv', 'bear_silent.webm']] | |
27 | 28 |
28 # Expected events for the first iteration and every iteration thereafter. | 29 # Expected events for the first iteration and every iteration thereafter. |
29 _EXPECTED_EVENTS_0 = [('ended', 2), ('playing', 2), ('seeked', 1)] | 30 _EXPECTED_EVENTS_0 = [('ended', 2), ('playing', 2), ('seeked', 1)] |
30 _EXPECTED_EVENTS_n = [('abort', 1), ('emptied', 1)] + _EXPECTED_EVENTS_0 | 31 _EXPECTED_EVENTS_n = [('abort', 1), ('emptied', 1)] + _EXPECTED_EVENTS_0 |
31 | 32 |
32 | 33 |
33 class MediaConstrainedNetworkPerfTest(pyauto.PyUITest): | 34 class MediaConstrainedNetworkPerfTest(pyauto.PyUITest): |
34 """PyAuto test container. See file doc string for more information.""" | 35 """PyAuto test container. See file doc string for more information.""" |
35 | 36 |
36 def testBasicPlaybackMatrix(self): | 37 def testBasicPlaybackMatrix(self): |
(...skipping 30 matching lines...) Expand all Loading... | |
67 else: | 68 else: |
68 self.assertEqual(counts, _EXPECTED_EVENTS_n) | 69 self.assertEqual(counts, _EXPECTED_EVENTS_n) |
69 except: | 70 except: |
70 logging.debug( | 71 logging.debug( |
71 'Test failed with events: %s', self.GetDOMValue("events.join(',')")) | 72 'Test failed with events: %s', self.GetDOMValue("events.join(',')")) |
72 raise | 73 raise |
73 | 74 |
74 | 75 |
75 if __name__ == '__main__': | 76 if __name__ == '__main__': |
76 pyauto_media.Main() | 77 pyauto_media.Main() |
OLD | NEW |