| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 # pylint: disable=W0401,W0614 | 4 # pylint: disable=W0401,W0614 |
| 5 from telemetry.page.actions.all_page_actions import * | 5 from telemetry.page.actions.all_page_actions import * |
| 6 from telemetry.page import page as page_module | 6 from telemetry.page import page as page_module |
| 7 from telemetry.page import page_set as page_set_module | 7 from telemetry.page import page_set as page_set_module |
| 8 | 8 |
| 9 | 9 |
| 10 class ToughVideoCasesPage(page_module.Page): | 10 class ToughVideoCasesPage(page_module.Page): |
| 11 | 11 |
| 12 def __init__(self, url, page_set): | 12 def __init__(self, url, page_set): |
| 13 super(ToughVideoCasesPage, self).__init__(url=url, page_set=page_set) | 13 super(ToughVideoCasesPage, self).__init__(url=url, page_set=page_set) |
| 14 | 14 |
| 15 def LoopMixedAudio(self, action_runner): | 15 def LoopMixedAudio(self, action_runner): |
| 16 action_runner.RunAction(PlayAction( | 16 action_runner.PlayMedia(selector='#background_audio', |
| 17 { | 17 playing_event_timeout_in_seconds=60) |
| 18 'wait_for_playing': True, | 18 action_runner.LoopMedia(loop_count=50, selector='#mixed_audio') |
| 19 'wait_for_ended': False, | |
| 20 'selector': '#background_audio' | |
| 21 })) | |
| 22 action_runner.RunAction(LoopAction( | |
| 23 { | |
| 24 'loop_count': 50, | |
| 25 'selector': '#mixed_audio' | |
| 26 })) | |
| 27 | 19 |
| 28 def LoopSingleAudio(self, action_runner): | 20 def LoopSingleAudio(self, action_runner): |
| 29 action_runner.RunAction(LoopAction( | 21 action_runner.LoopMedia(loop_count=50, selector='#single_audio') |
| 30 { | |
| 31 'loop_count': 50, | |
| 32 'selector': '#single_audio' | |
| 33 })) | |
| 34 | 22 |
| 35 def PlayAction(self, action_runner): | 23 def PlayAction(self, action_runner): |
| 36 action_runner.RunAction(PlayAction( | 24 action_runner.PlayMedia(playing_event_timeout_in_seconds=60, |
| 37 { | 25 ended_event_timeout_in_seconds=60) |
| 38 'wait_for_playing': True, | |
| 39 'wait_for_ended': True | |
| 40 })) | |
| 41 | 26 |
| 42 def SeekBeforeAndAfterPlayhead(self, action_runner): | 27 def SeekBeforeAndAfterPlayhead(self, action_runner): |
| 43 action_runner.RunAction(PlayAction( | 28 action_runner.PlayMedia(playing_event_timeout_in_seconds=60, |
| 44 { | 29 ended_event_timeout_in_seconds=60) |
| 45 'wait_for_playing': True, | |
| 46 'wait_for_ended': False | |
| 47 })) | |
| 48 # Wait for 1 second so that we know the play-head is at ~1s. | 30 # Wait for 1 second so that we know the play-head is at ~1s. |
| 49 action_runner.Wait(1) | 31 action_runner.Wait(1) |
| 50 # Seek to before the play-head location. | 32 # Seek to before the play-head location. |
| 51 action_runner.RunAction(SeekAction( | 33 action_runner.SeekMedia(seconds=0.5, timeout_in_seconds=60, |
| 52 { | 34 label='seek_warm') |
| 53 'seek_time': '0.5', | |
| 54 'wait_for_seeked': True, | |
| 55 'seek_label': 'seek_warm' | |
| 56 })) | |
| 57 # Seek to after the play-head location. | 35 # Seek to after the play-head location. |
| 58 action_runner.RunAction(SeekAction( | 36 action_runner.SeekMedia(seconds=9, timeout_in_seconds=60, |
| 59 { | 37 label='seek_cold') |
| 60 'seek_time': '9', | |
| 61 'wait_for_seeked': True, | |
| 62 'seek_label': 'seek_cold' | |
| 63 })) | |
| 64 | 38 |
| 65 | 39 |
| 66 class Page1(ToughVideoCasesPage): | 40 class Page1(ToughVideoCasesPage): |
| 67 | 41 |
| 68 def __init__(self, page_set): | 42 def __init__(self, page_set): |
| 69 super(Page1, self).__init__( | 43 super(Page1, self).__init__( |
| 70 url='file://tough_video_cases/video.html?src=crowd.wav&type=audio', | 44 url='file://tough_video_cases/video.html?src=crowd.wav&type=audio', |
| 71 page_set=page_set) | 45 page_set=page_set) |
| 72 | 46 |
| 73 self.add_browser_metrics = True | 47 self.add_browser_metrics = True |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 self.AddPage(Page20(self)) | 460 self.AddPage(Page20(self)) |
| 487 self.AddPage(Page21(self)) | 461 self.AddPage(Page21(self)) |
| 488 self.AddPage(Page22(self)) | 462 self.AddPage(Page22(self)) |
| 489 self.AddPage(Page23(self)) | 463 self.AddPage(Page23(self)) |
| 490 self.AddPage(Page24(self)) | 464 self.AddPage(Page24(self)) |
| 491 self.AddPage(Page25(self)) | 465 self.AddPage(Page25(self)) |
| 492 self.AddPage(Page26(self)) | 466 self.AddPage(Page26(self)) |
| 493 self.AddPage(Page27(self)) | 467 self.AddPage(Page27(self)) |
| 494 self.AddPage(Page28(self)) | 468 self.AddPage(Page28(self)) |
| 495 self.AddPage(Page29(self)) | 469 self.AddPage(Page29(self)) |
| OLD | NEW |