| 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 _PAGE_TAGS_LIST = [ | 7 _PAGE_TAGS_LIST = [ |
| 8 # Audio codecs: | 8 # Audio codecs: |
| 9 'pcm', | 9 'pcm', |
| 10 'mp3', | 10 'mp3', |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 if tags: | 34 if tags: |
| 35 for t in tags: | 35 for t in tags: |
| 36 assert t in _PAGE_TAGS_LIST | 36 assert t in _PAGE_TAGS_LIST |
| 37 super(ToughVideoCasesPage, self).__init__( | 37 super(ToughVideoCasesPage, self).__init__( |
| 38 url=url, page_set=page_set, tags=tags) | 38 url=url, page_set=page_set, tags=tags) |
| 39 | 39 |
| 40 def PlayAction(self, action_runner): | 40 def PlayAction(self, action_runner): |
| 41 # Play the media until it has finished or it times out. | 41 # Play the media until it has finished or it times out. |
| 42 action_runner.PlayMedia(playing_event_timeout_in_seconds=60, | 42 action_runner.PlayMedia(playing_event_timeout_in_seconds=60, |
| 43 ended_event_timeout_in_seconds=60) | 43 ended_event_timeout_in_seconds=60) |
| 44 # Generate memory dump for memoryMetric. |
| 45 if self.page_set.measure_memory: |
| 46 action_runner.MeasureMemory() |
| 44 | 47 |
| 45 def SeekBeforeAndAfterPlayhead(self, action_runner, | 48 def SeekBeforeAndAfterPlayhead(self, action_runner, |
| 46 action_timeout_in_seconds=60): | 49 action_timeout_in_seconds=60): |
| 47 timeout = action_timeout_in_seconds | 50 timeout = action_timeout_in_seconds |
| 48 # Start the media playback. | 51 # Start the media playback. |
| 49 action_runner.PlayMedia( | 52 action_runner.PlayMedia( |
| 50 playing_event_timeout_in_seconds=timeout) | 53 playing_event_timeout_in_seconds=timeout) |
| 51 # Wait for 1 second so that we know the play-head is at ~1s. | 54 # Wait for 1 second so that we know the play-head is at ~1s. |
| 52 action_runner.Wait(1) | 55 action_runner.Wait(1) |
| 53 # Seek to before the play-head location. | 56 # Seek to before the play-head location. |
| 54 action_runner.SeekMedia(seconds=0.5, timeout_in_seconds=timeout, | 57 action_runner.SeekMedia(seconds=0.5, timeout_in_seconds=timeout, |
| 55 label='seek_warm') | 58 label='seek_warm') |
| 56 # Seek to after the play-head location. | 59 # Seek to after the play-head location. |
| 57 action_runner.SeekMedia(seconds=9, timeout_in_seconds=timeout, | 60 action_runner.SeekMedia(seconds=9, timeout_in_seconds=timeout, |
| 58 label='seek_cold') | 61 label='seek_cold') |
| 62 # Generate memory dump for memoryMetric. |
| 63 if self.page_set.measure_memory: |
| 64 action_runner.MeasureMemory() |
| 59 | 65 |
| 60 | 66 |
| 61 class Page2(ToughVideoCasesPage): | 67 class Page2(ToughVideoCasesPage): |
| 62 | 68 |
| 63 def __init__(self, page_set): | 69 def __init__(self, page_set): |
| 64 super(Page2, self).__init__( | 70 super(Page2, self).__init__( |
| 65 url='file://tough_video_cases/video.html?src=crowd.ogg&type=audio', | 71 url='file://tough_video_cases/video.html?src=crowd.ogg&type=audio', |
| 66 page_set=page_set, | 72 page_set=page_set, |
| 67 tags=['vorbis', 'audio_only']) | 73 tags=['vorbis', 'audio_only']) |
| 68 | 74 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 def RunPageInteractions(self, action_runner): | 400 def RunPageInteractions(self, action_runner): |
| 395 self.SeekBeforeAndAfterPlayhead(action_runner, | 401 self.SeekBeforeAndAfterPlayhead(action_runner, |
| 396 action_timeout_in_seconds=120) | 402 action_timeout_in_seconds=120) |
| 397 | 403 |
| 398 | 404 |
| 399 class ToughVideoCasesPageSet(story.StorySet): | 405 class ToughVideoCasesPageSet(story.StorySet): |
| 400 """ | 406 """ |
| 401 Description: Video Stack Perf pages that report time_to_play, seek time and | 407 Description: Video Stack Perf pages that report time_to_play, seek time and |
| 402 many other media-specific and generic metrics. | 408 many other media-specific and generic metrics. |
| 403 """ | 409 """ |
| 404 def __init__(self): | 410 def __init__(self, measure_memory=False): |
| 405 super(ToughVideoCasesPageSet, self).__init__( | 411 super(ToughVideoCasesPageSet, self).__init__( |
| 406 cloud_storage_bucket=story.PARTNER_BUCKET) | 412 cloud_storage_bucket=story.PARTNER_BUCKET) |
| 407 | 413 |
| 414 self.measure_memory = measure_memory |
| 415 |
| 408 # Normal play tests: | 416 # Normal play tests: |
| 409 self.AddStory(Page2(self)) | 417 self.AddStory(Page2(self)) |
| 410 self.AddStory(Page4(self)) | 418 self.AddStory(Page4(self)) |
| 411 self.AddStory(Page7(self)) | 419 self.AddStory(Page7(self)) |
| 412 self.AddStory(Page8(self)) | 420 self.AddStory(Page8(self)) |
| 413 self.AddStory(Page11(self)) | 421 self.AddStory(Page11(self)) |
| 414 self.AddStory(Page12(self)) | 422 self.AddStory(Page12(self)) |
| 415 self.AddStory(Page13(self)) | 423 self.AddStory(Page13(self)) |
| 416 self.AddStory(Page14(self)) | 424 self.AddStory(Page14(self)) |
| 417 self.AddStory(Page15(self)) | 425 self.AddStory(Page15(self)) |
| 418 self.AddStory(Page16(self)) | 426 self.AddStory(Page16(self)) |
| 419 self.AddStory(Page17(self)) | 427 self.AddStory(Page17(self)) |
| 420 self.AddStory(Page30(self)) | 428 self.AddStory(Page30(self)) |
| 421 self.AddStory(Page32(self)) | 429 self.AddStory(Page32(self)) |
| 422 self.AddStory(Page34(self)) | 430 self.AddStory(Page34(self)) |
| 423 | 431 |
| 424 # Seek tests: | 432 # Seek tests: |
| 425 self.AddStory(Page19(self)) | 433 self.AddStory(Page19(self)) |
| 426 self.AddStory(Page20(self)) | 434 self.AddStory(Page20(self)) |
| 427 self.AddStory(Page23(self)) | 435 self.AddStory(Page23(self)) |
| 428 self.AddStory(Page24(self)) | 436 self.AddStory(Page24(self)) |
| 429 self.AddStory(Page25(self)) | 437 self.AddStory(Page25(self)) |
| 430 self.AddStory(Page26(self)) | 438 self.AddStory(Page26(self)) |
| 431 self.AddStory(Page31(self)) | 439 self.AddStory(Page31(self)) |
| 432 self.AddStory(Page33(self)) | 440 self.AddStory(Page33(self)) |
| 433 self.AddStory(Page35(self)) | 441 self.AddStory(Page35(self)) |
| 434 self.AddStory(Page36(self)) | 442 self.AddStory(Page36(self)) |
| OLD | NEW |