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 BasicPlayPage(page_module.Page): | 10 class BasicPlayPage(page_module.Page): |
11 | 11 |
12 def __init__(self, url, page_set): | 12 def __init__(self, url, page_set): |
13 super(BasicPlayPage, self).__init__(url=url, page_set=page_set) | 13 super(BasicPlayPage, self).__init__(url=url, page_set=page_set) |
14 self.add_browser_metrics = True | 14 self.add_browser_metrics = True |
15 | 15 |
16 def PlayAction(self, action_runner): | 16 def PlayAction(self, action_runner): |
17 action_runner.RunAction(PlayAction( | 17 action_runner.PlayMedia(playing_event_timeout_in_seconds=60, |
18 { | 18 ended_event_timeout_in_seconds=60) |
19 'wait_for_playing': True, | |
20 'wait_for_ended': True | |
21 })) | |
22 | 19 |
23 def RunMediaMetrics(self, action_runner): | 20 def RunMediaMetrics(self, action_runner): |
24 self.PlayAction(action_runner) | 21 self.PlayAction(action_runner) |
25 | 22 |
26 def SeekBeforeAndAfterPlayhead(self, action_runner): | 23 def SeekBeforeAndAfterPlayhead(self, action_runner): |
27 action_runner.RunAction(PlayAction( | 24 action_runner.PlayMedia(playing_event_timeout_in_seconds=60) |
28 { | |
29 'wait_for_playing': True, | |
30 'wait_for_ended': False | |
31 })) | |
32 # Wait for 1 second so that we know the play-head is at ~1s. | 25 # Wait for 1 second so that we know the play-head is at ~1s. |
33 action_runner.Wait(1) | 26 action_runner.Wait(1) |
34 # Seek to before the play-head location. | 27 # Seek to before the play-head location. |
35 action_runner.RunAction(SeekAction( | 28 action_runner.SeekMedia(seconds=0.5, timeout_in_seconds=60, |
36 { | 29 label='seek_warm') |
37 'seek_time': '0.5', | |
38 'wait_for_seeked': True, | |
39 'seek_label': 'seek_warm' | |
40 })) | |
41 # Seek to after the play-head location. | 30 # Seek to after the play-head location. |
42 action_runner.RunAction(SeekAction( | 31 action_runner.SeekMedia(seconds=15, timeout_in_seconds=60, |
43 { | 32 label='seek_cold') |
44 'seek_time': 15, | |
45 'wait_for_seeked': True, | |
46 'seek_label': 'seek_cold' | |
47 })) | |
48 | 33 |
49 class SeekBeforeAndAfterPlayheadPage(BasicPlayPage): | 34 class SeekBeforeAndAfterPlayheadPage(BasicPlayPage): |
50 | 35 |
51 def __init__(self, url, page_set): | 36 def __init__(self, url, page_set): |
52 super(SeekBeforeAndAfterPlayheadPage, self).__init__(url=url, | 37 super(SeekBeforeAndAfterPlayheadPage, self).__init__(url=url, |
53 page_set=page_set) | 38 page_set=page_set) |
54 self.add_browser_metrics = False | 39 self.add_browser_metrics = False |
55 | 40 |
56 def RunMediaMetrics(self, action_runner): | 41 def RunMediaMetrics(self, action_runner): |
57 self.SeekBeforeAndAfterPlayhead(action_runner) | 42 self.SeekBeforeAndAfterPlayhead(action_runner) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 # pylint: disable=C0301 | 109 # pylint: disable=C0301 |
125 'file://tough_video_cases/video.html?id=wifi_mp4&src=tulip2.mp4&type=audio
&net=wifi', | 110 'file://tough_video_cases/video.html?id=wifi_mp4&src=tulip2.mp4&type=audio
&net=wifi', |
126 # pylint: disable=C0301 | 111 # pylint: disable=C0301 |
127 'file://tough_video_cases/video.html?id=wifi_ogv&src=tulip2.ogv&type=audio
&net=wifi', | 112 'file://tough_video_cases/video.html?id=wifi_ogv&src=tulip2.ogv&type=audio
&net=wifi', |
128 # pylint: disable=C0301 | 113 # pylint: disable=C0301 |
129 'file://tough_video_cases/video.html?id=wifi_webm&src=tulip2.webm&type=aud
io&net=wifi' | 114 'file://tough_video_cases/video.html?id=wifi_webm&src=tulip2.webm&type=aud
io&net=wifi' |
130 ] | 115 ] |
131 | 116 |
132 for url in urls_list2: | 117 for url in urls_list2: |
133 self.AddPage(SeekBeforeAndAfterPlayheadPage(url, self)) | 118 self.AddPage(SeekBeforeAndAfterPlayheadPage(url, self)) |
OLD | NEW |