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 16 matching lines...) Expand all Loading... |
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 _EXPECTED_EVENTS_n = [('abort', 1), ('emptied', 1)] + _EXPECTED_EVENTS_0 | 31 _EXPECTED_EVENTS_n = [('abort', 1), ('emptied', 1)] + _EXPECTED_EVENTS_0 |
32 | 32 |
33 | 33 |
34 class MediaConstrainedNetworkPerfTest(pyauto.PyUITest): | 34 class MediaConstrainedNetworkPerfTest(pyauto.PyUITest): |
35 """PyAuto test container. See file doc string for more information.""" | 35 """PyAuto test container. See file doc string for more information.""" |
36 | 36 |
| 37 def ExtraChromeFlags(self): |
| 38 """Run with --disable-audio to avoid issues with bots with no audio output. |
| 39 |
| 40 TODO(shadi): Remove extra flag once issue (crbug.com/120749) is resolved. |
| 41 """ |
| 42 return pyauto.PyUITest.ExtraChromeFlags(self) + ['--disable-audio'] |
| 43 |
37 def testBasicPlaybackMatrix(self): | 44 def testBasicPlaybackMatrix(self): |
38 """Launches HTML test which plays each video until end, seeks, and replays. | 45 """Launches HTML test which plays each video until end, seeks, and replays. |
39 | 46 |
40 Specifically ensures that after the above sequence of events, the following | 47 Specifically ensures that after the above sequence of events, the following |
41 are true: | 48 are true: |
42 | 49 |
43 1. The first video has only 2x playing, 2x ended, and 1x seeked events. | 50 1. The first video has only 2x playing, 2x ended, and 1x seeked events. |
44 2. Each subsequent video additionally has 1x abort and 1x emptied due to | 51 2. Each subsequent video additionally has 1x abort and 1x emptied due to |
45 switching of the src attribute. | 52 switching of the src attribute. |
46 3. video.currentTime == video.duration for each video. | 53 3. video.currentTime == video.duration for each video. |
(...skipping 21 matching lines...) Expand all Loading... |
68 else: | 75 else: |
69 self.assertEqual(counts, _EXPECTED_EVENTS_n) | 76 self.assertEqual(counts, _EXPECTED_EVENTS_n) |
70 except: | 77 except: |
71 logging.debug( | 78 logging.debug( |
72 'Test failed with events: %s', self.GetDOMValue("events.join(',')")) | 79 'Test failed with events: %s', self.GetDOMValue("events.join(',')")) |
73 raise | 80 raise |
74 | 81 |
75 | 82 |
76 if __name__ == '__main__': | 83 if __name__ == '__main__': |
77 pyauto_media.Main() | 84 pyauto_media.Main() |
OLD | NEW |