| 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 from telemetry.page import page as page_module | 4 from telemetry.page import page as page_module |
| 5 from telemetry import story | 5 from telemetry import story |
| 6 | 6 |
| 7 | 7 |
| 8 class ToughVideoCasesPage(page_module.Page): | 8 class ToughVideoCasesPage(page_module.Page): |
| 9 | 9 |
| 10 def __init__(self, url, page_set, labels=None): | 10 def __init__(self, url, page_set, labels=None): |
| 11 super(ToughVideoCasesPage, self).__init__( | 11 super(ToughVideoCasesPage, self).__init__( |
| 12 url=url, page_set=page_set, labels=labels) | 12 url=url, page_set=page_set, labels=labels) |
| 13 | 13 |
| 14 def LoopMixedAudio(self, action_runner): | 14 def LoopMixedAudio(self, action_runner): |
| 15 action_runner.PlayMedia(selector='#background_audio', | 15 action_runner.PlayMedia(selector='#background_audio', |
| 16 playing_event_timeout_in_seconds=60) | 16 playing_event_timeout_in_seconds=60) |
| 17 action_runner.LoopMedia(loop_count=50, selector='#mixed_audio') | 17 action_runner.LoopMedia(loop_count=50, selector='#mixed_audio') |
| 18 | 18 |
| 19 def LoopSingleAudio(self, action_runner): | 19 def LoopSingleAudio(self, action_runner): |
| 20 action_runner.LoopMedia(loop_count=50, selector='#single_audio') | 20 action_runner.LoopMedia(loop_count=50, selector='#single_audio') |
| 21 | 21 |
| 22 def PlayAction(self, action_runner): | 22 def PlayAction(self, action_runner): |
| 23 action_runner.PlayMedia(playing_event_timeout_in_seconds=60, | 23 action_runner.PlayMedia(playing_event_timeout_in_seconds=60, |
| 24 ended_event_timeout_in_seconds=60) | 24 ended_event_timeout_in_seconds=60) |
| 25 | 25 |
| 26 def SeekBeforeAndAfterPlayhead(self, action_runner): | 26 def SeekBeforeAndAfterPlayhead(self, action_runner, |
| 27 action_runner.PlayMedia(playing_event_timeout_in_seconds=60, | 27 action_timeout_in_seconds=60): |
| 28 ended_event_timeout_in_seconds=60) | 28 timeout = action_timeout_in_seconds |
| 29 # Wait for 1 second so that we know the play-head is at ~1s. | 29 # Because an ended timeout is passed, this won't return until the media has |
| 30 # played through. |
| 31 action_runner.PlayMedia(playing_event_timeout_in_seconds=timeout, |
| 32 ended_event_timeout_in_seconds=timeout) |
| 33 # Wait 1 second for no reason in particular. |
| 30 action_runner.Wait(1) | 34 action_runner.Wait(1) |
| 31 # Seek to before the play-head location. | 35 # Seek to before the play-head location. |
| 32 action_runner.SeekMedia(seconds=0.5, timeout_in_seconds=60, | 36 action_runner.SeekMedia(seconds=0.5, timeout_in_seconds=timeout, |
| 33 label='seek_warm') | 37 label='seek_warm') |
| 34 # Seek to after the play-head location. | 38 # Seek to after the play-head location. |
| 35 action_runner.SeekMedia(seconds=9, timeout_in_seconds=60, | 39 action_runner.SeekMedia(seconds=9, timeout_in_seconds=timeout, |
| 36 label='seek_cold') | 40 label='seek_cold') |
| 37 | 41 |
| 38 | 42 |
| 39 class Page1(ToughVideoCasesPage): | 43 class Page1(ToughVideoCasesPage): |
| 40 | 44 |
| 41 def __init__(self, page_set): | 45 def __init__(self, page_set): |
| 42 super(Page1, self).__init__( | 46 super(Page1, self).__init__( |
| 43 url='file://tough_video_cases/video.html?src=crowd.wav&type=audio', | 47 url='file://tough_video_cases/video.html?src=crowd.wav&type=audio', |
| 44 page_set=page_set) | 48 page_set=page_set) |
| 45 | 49 |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 | 493 |
| 490 def __init__(self, page_set): | 494 def __init__(self, page_set): |
| 491 super(Page36, self).__init__( | 495 super(Page36, self).__init__( |
| 492 url=('file://tough_video_cases/video.html?src=' | 496 url=('file://tough_video_cases/video.html?src=' |
| 493 'smpte_3840x2160_60fps_vp9.webm'), | 497 'smpte_3840x2160_60fps_vp9.webm'), |
| 494 page_set=page_set) | 498 page_set=page_set) |
| 495 | 499 |
| 496 self.add_browser_metrics = True | 500 self.add_browser_metrics = True |
| 497 | 501 |
| 498 def RunPageInteractions(self, action_runner): | 502 def RunPageInteractions(self, action_runner): |
| 499 self.SeekBeforeAndAfterPlayhead(action_runner) | 503 self.SeekBeforeAndAfterPlayhead(action_runner, |
| 504 action_timeout_in_seconds=120) |
| 500 | 505 |
| 501 class Page37(ToughVideoCasesPage): | 506 class Page37(ToughVideoCasesPage): |
| 502 | 507 |
| 503 def __init__(self, page_set): | 508 def __init__(self, page_set): |
| 504 super(Page37, self).__init__( | 509 super(Page37, self).__init__( |
| 505 url='file://tough_video_cases/video.html?src=crowd1080_vp9.webm&canvas=tru
e', | 510 url='file://tough_video_cases/video.html?src=crowd1080_vp9.webm&canvas=tru
e', |
| 506 page_set=page_set) | 511 page_set=page_set) |
| 507 | 512 |
| 508 self.add_browser_metrics = True | 513 self.add_browser_metrics = True |
| 509 | 514 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 self.AddStory(Page23(self)) | 603 self.AddStory(Page23(self)) |
| 599 self.AddStory(Page24(self)) | 604 self.AddStory(Page24(self)) |
| 600 self.AddStory(Page25(self)) | 605 self.AddStory(Page25(self)) |
| 601 self.AddStory(Page26(self)) | 606 self.AddStory(Page26(self)) |
| 602 self.AddStory(Page27(self)) | 607 self.AddStory(Page27(self)) |
| 603 self.AddStory(Page28(self)) | 608 self.AddStory(Page28(self)) |
| 604 self.AddStory(Page29(self)) | 609 self.AddStory(Page29(self)) |
| 605 self.AddStory(Page31(self)) | 610 self.AddStory(Page31(self)) |
| 606 self.AddStory(Page33(self)) | 611 self.AddStory(Page33(self)) |
| 607 self.AddStory(Page35(self)) | 612 self.AddStory(Page35(self)) |
| OLD | NEW |