| 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', |
| 11 'aac', | 11 'aac', |
| 12 'vorbis', | 12 'vorbis', |
| 13 'opus', | 13 'opus', |
| 14 # Video codecs: | 14 # Video codecs: |
| 15 'theora', | 15 'theora', |
| 16 'h264', | 16 'h264', |
| 17 'vp8', | 17 'vp8', |
| 18 'vp9', | 18 'vp9', |
| 19 # Test types: | 19 # Test types: |
| 20 'audio_video', | 20 'audio_video', |
| 21 'audio_only', | 21 'audio_only', |
| 22 'video_only', | 22 'video_only', |
| 23 'looping_audio', | |
| 24 # Other filter tags: | 23 # Other filter tags: |
| 25 'is_50fps', | 24 'is_50fps', |
| 26 'is_4k', | 25 'is_4k', |
| 27 ] | 26 ] |
| 28 | 27 |
| 29 | 28 |
| 30 class ToughVideoCasesPage(page_module.Page): | 29 class ToughVideoCasesPage(page_module.Page): |
| 31 | 30 |
| 32 def __init__(self, url, page_set, tags): | 31 def __init__(self, url, page_set, tags): |
| 33 if tags: | 32 if tags: |
| 34 for t in tags: | 33 for t in tags: |
| 35 assert t in _PAGE_TAGS_LIST | 34 assert t in _PAGE_TAGS_LIST |
| 36 super(ToughVideoCasesPage, self).__init__( | 35 super(ToughVideoCasesPage, self).__init__( |
| 37 url=url, page_set=page_set, tags=tags) | 36 url=url, page_set=page_set, tags=tags) |
| 38 | 37 |
| 39 def LoopMixedAudio(self, action_runner): | |
| 40 action_runner.PlayMedia(selector='#background_audio', | |
| 41 playing_event_timeout_in_seconds=60) | |
| 42 action_runner.LoopMedia(loop_count=50, selector='#mixed_audio') | |
| 43 | |
| 44 def LoopSingleAudio(self, action_runner): | |
| 45 action_runner.LoopMedia(loop_count=50, selector='#single_audio') | |
| 46 | |
| 47 def PlayAction(self, action_runner): | 38 def PlayAction(self, action_runner): |
| 48 # Play the media until it has finished or it times out. | 39 # Play the media until it has finished or it times out. |
| 49 action_runner.PlayMedia(playing_event_timeout_in_seconds=60, | 40 action_runner.PlayMedia(playing_event_timeout_in_seconds=60, |
| 50 ended_event_timeout_in_seconds=60) | 41 ended_event_timeout_in_seconds=60) |
| 51 | 42 |
| 52 def SeekBeforeAndAfterPlayhead(self, action_runner, | 43 def SeekBeforeAndAfterPlayhead(self, action_runner, |
| 53 action_timeout_in_seconds=60): | 44 action_timeout_in_seconds=60): |
| 54 timeout = action_timeout_in_seconds | 45 timeout = action_timeout_in_seconds |
| 55 # Start the media playback. | 46 # Start the media playback. |
| 56 action_runner.PlayMedia( | 47 action_runner.PlayMedia( |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 url='file://tough_video_cases/video.html?src=garden2_10s.ogv', | 433 url='file://tough_video_cases/video.html?src=garden2_10s.ogv', |
| 443 page_set=page_set, | 434 page_set=page_set, |
| 444 tags=['is_4k', 'theora', 'vorbis', 'audio_video']) | 435 tags=['is_4k', 'theora', 'vorbis', 'audio_video']) |
| 445 | 436 |
| 446 self.skip_basic_metrics = True | 437 self.skip_basic_metrics = True |
| 447 | 438 |
| 448 def RunPageInteractions(self, action_runner): | 439 def RunPageInteractions(self, action_runner): |
| 449 self.SeekBeforeAndAfterPlayhead(action_runner) | 440 self.SeekBeforeAndAfterPlayhead(action_runner) |
| 450 | 441 |
| 451 | 442 |
| 452 class Page28(ToughVideoCasesPage): | |
| 453 | |
| 454 # This page tests looping a single audio track. | |
| 455 def __init__(self, page_set): | |
| 456 super(Page28, self).__init__( | |
| 457 url='file://tough_video_cases/audio_playback.html?id=single_audio', | |
| 458 page_set=page_set, | |
| 459 tags=['pcm', 'looping_audio']) | |
| 460 | |
| 461 self.skip_basic_metrics = True | |
| 462 | |
| 463 def RunPageInteractions(self, action_runner): | |
| 464 self.LoopSingleAudio(action_runner) | |
| 465 | |
| 466 | |
| 467 class Page29(ToughVideoCasesPage): | |
| 468 | |
| 469 # This page tests looping an audio track and playing another in the | |
| 470 # background. | |
| 471 def __init__(self, page_set): | |
| 472 super(Page29, self).__init__( | |
| 473 url='file://tough_video_cases/audio_playback.html?id=mixed_audio', | |
| 474 page_set=page_set, | |
| 475 tags=['pcm', 'looping_audio']) | |
| 476 | |
| 477 self.skip_basic_metrics = True | |
| 478 | |
| 479 def RunPageInteractions(self, action_runner): | |
| 480 self.LoopMixedAudio(action_runner) | |
| 481 | |
| 482 class Page30(ToughVideoCasesPage): | 443 class Page30(ToughVideoCasesPage): |
| 483 | 444 |
| 484 def __init__(self, page_set): | 445 def __init__(self, page_set): |
| 485 super(Page30, self).__init__( | 446 super(Page30, self).__init__( |
| 486 url='file://tough_video_cases/video.html?src=tulip2.vp9.webm', | 447 url='file://tough_video_cases/video.html?src=tulip2.vp9.webm', |
| 487 page_set=page_set, | 448 page_set=page_set, |
| 488 tags=['vp9', 'opus', 'audio_video']) | 449 tags=['vp9', 'opus', 'audio_video']) |
| 489 | 450 |
| 490 self.add_browser_metrics = True | 451 self.add_browser_metrics = True |
| 491 | 452 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 page_set=page_set, | 585 page_set=page_set, |
| 625 tags=['is_50fps', 'theora', 'vorbis', 'audio_video']) | 586 tags=['is_50fps', 'theora', 'vorbis', 'audio_video']) |
| 626 | 587 |
| 627 self.add_browser_metrics = True | 588 self.add_browser_metrics = True |
| 628 | 589 |
| 629 def RunPageInteractions(self, action_runner): | 590 def RunPageInteractions(self, action_runner): |
| 630 self.PlayAction(action_runner) | 591 self.PlayAction(action_runner) |
| 631 | 592 |
| 632 class ToughVideoCasesPageSet(story.StorySet): | 593 class ToughVideoCasesPageSet(story.StorySet): |
| 633 """ | 594 """ |
| 634 Description: Video Stack Perf benchmark that report time_to_play. | 595 Description: Video Stack Perf pages that report time_to_play and many other |
| 596 media-specific and generic metrics. |
| 635 """ | 597 """ |
| 636 def __init__(self): | 598 def __init__(self): |
| 637 super(ToughVideoCasesPageSet, self).__init__( | 599 super(ToughVideoCasesPageSet, self).__init__( |
| 638 cloud_storage_bucket=story.PARTNER_BUCKET) | 600 cloud_storage_bucket=story.PARTNER_BUCKET) |
| 639 # TODO(crouleau): Pages 36 and 38 are in ToughVideoCasesPageSet even though | 601 # TODO(crouleau): Pages 36 and 38 are in ToughVideoCasesPageSet even though |
| 640 # they both report seek time instead of time_to_play. | 602 # they both report seek time instead of time_to_play. |
| 641 # This may be a non-issue because we plan to merge these two page sets back | 603 # This may be a non-issue because we plan to merge these two page sets back |
| 642 # together and use tags to allow teams to filter which pages they want. | 604 # together and use tags to allow teams to filter which pages they want. |
| 643 | 605 |
| 644 self.AddStory(Page1(self)) | 606 self.AddStory(Page1(self)) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 664 self.AddStory(Page34(self)) | 626 self.AddStory(Page34(self)) |
| 665 self.AddStory(Page36(self)) | 627 self.AddStory(Page36(self)) |
| 666 self.AddStory(Page37(self)) | 628 self.AddStory(Page37(self)) |
| 667 self.AddStory(Page38(self)) | 629 self.AddStory(Page38(self)) |
| 668 self.AddStory(Page39(self)) | 630 self.AddStory(Page39(self)) |
| 669 self.AddStory(Page40(self)) | 631 self.AddStory(Page40(self)) |
| 670 | 632 |
| 671 | 633 |
| 672 class ToughVideoCasesExtraPageSet(story.StorySet): | 634 class ToughVideoCasesExtraPageSet(story.StorySet): |
| 673 """ | 635 """ |
| 674 Description: Video Stack Perf benchmarks that report seek time and audio | 636 Description: Video Stack Perf pages that only report seek time. |
| 675 avg_loop_time. | |
| 676 """ | 637 """ |
| 677 def __init__(self): | 638 def __init__(self): |
| 678 super(ToughVideoCasesExtraPageSet, self).__init__( | 639 super(ToughVideoCasesExtraPageSet, self).__init__( |
| 679 cloud_storage_bucket=story.PARTNER_BUCKET) | 640 cloud_storage_bucket=story.PARTNER_BUCKET) |
| 680 | 641 |
| 681 self.AddStory(Page19(self)) | 642 self.AddStory(Page19(self)) |
| 682 self.AddStory(Page20(self)) | 643 self.AddStory(Page20(self)) |
| 683 self.AddStory(Page21(self)) | 644 self.AddStory(Page21(self)) |
| 684 self.AddStory(Page22(self)) | 645 self.AddStory(Page22(self)) |
| 685 self.AddStory(Page23(self)) | 646 self.AddStory(Page23(self)) |
| 686 self.AddStory(Page24(self)) | 647 self.AddStory(Page24(self)) |
| 687 self.AddStory(Page25(self)) | 648 self.AddStory(Page25(self)) |
| 688 self.AddStory(Page26(self)) | 649 self.AddStory(Page26(self)) |
| 689 self.AddStory(Page27(self)) | 650 self.AddStory(Page27(self)) |
| 690 self.AddStory(Page28(self)) | |
| 691 self.AddStory(Page29(self)) | |
| 692 self.AddStory(Page31(self)) | 651 self.AddStory(Page31(self)) |
| 693 self.AddStory(Page33(self)) | 652 self.AddStory(Page33(self)) |
| 694 self.AddStory(Page35(self)) | 653 self.AddStory(Page35(self)) |
| OLD | NEW |