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