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 """ |
(...skipping 14 matching lines...) Expand all Loading... |
25 pyauto.PyUITest.GetFileURLForContentDataPath('media', name) | 25 pyauto.PyUITest.GetFileURLForContentDataPath('media', name) |
26 for name in ['bear.mp4', 'bear.ogv', 'bear.webm', 'bear_silent.mp4', | 26 for name in ['bear.mp4', 'bear.ogv', 'bear.webm', 'bear_silent.mp4', |
27 'bear_silent.ogv', 'bear_silent.webm']] | 27 'bear_silent.ogv', 'bear_silent.webm']] |
28 | 28 |
29 # Expected events for the first iteration and every iteration thereafter. | 29 # Expected events for the first iteration and every iteration thereafter. |
30 _EXPECTED_EVENTS_0 = [('ended', 2), ('playing', 2), ('seeked', 1), | 30 _EXPECTED_EVENTS_0 = [('ended', 2), ('playing', 2), ('seeked', 1), |
31 ('suspend', 1)] | 31 ('suspend', 1)] |
32 _EXPECTED_EVENTS_n = [('abort', 1), ('emptied', 1)] + _EXPECTED_EVENTS_0 | 32 _EXPECTED_EVENTS_n = [('abort', 1), ('emptied', 1)] + _EXPECTED_EVENTS_0 |
33 | 33 |
34 | 34 |
35 class MediaConstrainedNetworkPerfTest(pyauto.PyUITest): | 35 class MediaBasicPlaybackTest(pyauto.PyUITest): |
36 """PyAuto test container. See file doc string for more information.""" | 36 """PyAuto test container. See file doc string for more information.""" |
37 | 37 |
38 def ExtraChromeFlags(self): | 38 def ExtraChromeFlags(self): |
39 """Run with --disable-audio to avoid issues with bots with no audio output. | 39 """Run with --disable-audio to avoid issues with bots with no audio output. |
40 | 40 |
41 TODO(shadi): Remove extra flag once issue (crbug.com/120749) is resolved. | 41 TODO(shadi): Remove extra flag once issue (crbug.com/120749) is resolved. |
42 """ | 42 """ |
43 return pyauto.PyUITest.ExtraChromeFlags(self) + ['--disable-audio'] | 43 return pyauto.PyUITest.ExtraChromeFlags(self) + ['--disable-audio'] |
44 | 44 |
45 def testBasicPlaybackMatrix(self): | 45 def testBasicPlaybackMatrix(self): |
(...skipping 30 matching lines...) Expand all Loading... |
76 else: | 76 else: |
77 self.assertEqual(counts, _EXPECTED_EVENTS_n) | 77 self.assertEqual(counts, _EXPECTED_EVENTS_n) |
78 except: | 78 except: |
79 logging.debug( | 79 logging.debug( |
80 'Test failed with events: %s', self.GetDOMValue("events.join(',')")) | 80 'Test failed with events: %s', self.GetDOMValue("events.join(',')")) |
81 raise | 81 raise |
82 | 82 |
83 | 83 |
84 if __name__ == '__main__': | 84 if __name__ == '__main__': |
85 pyauto_media.Main() | 85 pyauto_media.Main() |
OLD | NEW |