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
3 # found in the LICENSE file.
4 # pylint: disable=W0401,W0614
5 from telemetry.page.actions.all_page_actions import *
6 from telemetry.page import page as page_module
7 from telemetry.page import page_set as page_set_module
10 class ToughVideoCasesPage(page_module.Page):
12 def __init__(self, url, page_set):
13 super(ToughVideoCasesPage, self).__init__(url=url, page_set=page_set)
15 def LoopMixedAudio(self, action_runner):
16 action_runner.RunAction(PlayAction(
18 'wait_for_playing': True,
19 'wait_for_ended': False,
20 'selector': '#background_audio'
22 action_runner.RunAction(LoopAction(
25 'selector': '#mixed_audio'
28 def LoopSingleAudio(self, action_runner):
29 action_runner.RunAction(LoopAction(
32 'selector': '#single_audio'
35 def PlayAction(self, action_runner):
36 action_runner.RunAction(PlayAction(
38 'wait_for_playing': True,
39 'wait_for_ended': True
42 def SeekBeforeAndAfterPlayhead(self, action_runner):
43 action_runner.RunAction(PlayAction(
45 'wait_for_playing': True,
46 'wait_for_ended': False
48 # Wait for 1 second so that we know the play-head is at ~1s.
49 action_runner.RunAction(WaitAction(
53 # Seek to before the play-head location.
54 action_runner.RunAction(SeekAction(
57 'wait_for_seeked': True,
58 'seek_label': 'seek_warm'
60 # Seek to after the play-head location.
61 action_runner.RunAction(SeekAction(
64 'wait_for_seeked': True,
65 'seek_label': 'seek_cold'
69 class Page1(ToughVideoCasesPage):
71 def __init__(self, page_set):
72 super(Page1, self).__init__(
73 url='file://tough_video_cases/video.html?src=crowd.wav&type=audio',
76 self.add_browser_metrics = True
78 def RunMediaMetrics(self, action_runner):
79 self.PlayAction(action_runner)
82 class Page2(ToughVideoCasesPage):
84 def __init__(self, page_set):
85 super(Page2, self).__init__(
86 url='file://tough_video_cases/video.html?src=crowd.ogg&type=audio',
89 self.add_browser_metrics = True
91 def RunMediaMetrics(self, action_runner):
92 self.PlayAction(action_runner)
95 class Page3(ToughVideoCasesPage):
97 def __init__(self, page_set):
98 super(Page3, self).__init__(
99 url='file://tough_video_cases/video.html?src=crowd1080.ogv',
102 self.add_browser_metrics = True
105 def RunMediaMetrics(self, action_runner):
106 self.PlayAction(action_runner)
109 class Page4(ToughVideoCasesPage):
111 def __init__(self, page_set):
112 super(Page4, self).__init__(
113 url='file://tough_video_cases/video.html?src=crowd1080.webm',
116 self.add_browser_metrics = True
119 def RunMediaMetrics(self, action_runner):
120 self.PlayAction(action_runner)
123 class Page5(ToughVideoCasesPage):
125 def __init__(self, page_set):
126 super(Page5, self).__init__(
127 url='file://tough_video_cases/video.html?src=crowd2160.ogv',
130 self.add_browser_metrics = True
134 def RunMediaMetrics(self, action_runner):
135 self.PlayAction(action_runner)
138 class Page6(ToughVideoCasesPage):
140 def __init__(self, page_set):
141 super(Page6, self).__init__(
142 url='file://tough_video_cases/video.html?src=crowd2160.webm',
145 self.add_browser_metrics = True
149 def RunMediaMetrics(self, action_runner):
150 self.PlayAction(action_runner)
153 class Page7(ToughVideoCasesPage):
155 def __init__(self, page_set):
156 super(Page7, self).__init__(
157 url='file://tough_video_cases/video.html?src=tulip2.ogg&type=audio',
160 self.add_browser_metrics = True
162 def RunMediaMetrics(self, action_runner):
163 self.PlayAction(action_runner)
166 class Page8(ToughVideoCasesPage):
168 def __init__(self, page_set):
169 super(Page8, self).__init__(
170 url='file://tough_video_cases/video.html?src=tulip2.wav&type=audio',
173 self.add_browser_metrics = True
175 def RunMediaMetrics(self, action_runner):
176 self.PlayAction(action_runner)
179 class Page9(ToughVideoCasesPage):
181 def __init__(self, page_set):
182 super(Page9, self).__init__(
183 url='file://tough_video_cases/video.html?src=tulip2.ogv',
186 self.add_browser_metrics = True
188 def RunMediaMetrics(self, action_runner):
189 self.PlayAction(action_runner)
192 class Page10(ToughVideoCasesPage):
194 def __init__(self, page_set):
195 super(Page10, self).__init__(
196 url='file://tough_video_cases/video.html?src=tulip2.webm',
199 self.add_browser_metrics = True
201 def RunMediaMetrics(self, action_runner):
202 self.PlayAction(action_runner)
205 class Page11(ToughVideoCasesPage):
207 def __init__(self, page_set):
208 super(Page11, self).__init__(
209 url='file://tough_video_cases/video.html?src=crowd1080.mp4',
212 self.add_browser_metrics = True
215 def RunMediaMetrics(self, action_runner):
216 self.PlayAction(action_runner)
219 class Page12(ToughVideoCasesPage):
221 def __init__(self, page_set):
222 super(Page12, self).__init__(
223 url='file://tough_video_cases/video.html?src=crowd2160.mp4',
226 self.add_browser_metrics = True
230 def RunMediaMetrics(self, action_runner):
231 self.PlayAction(action_runner)
234 class Page13(ToughVideoCasesPage):
236 def __init__(self, page_set):
237 super(Page13, self).__init__(
238 url='file://tough_video_cases/video.html?src=tulip2.mp3&type=audio',
241 self.add_browser_metrics = True
243 def RunMediaMetrics(self, action_runner):
244 self.PlayAction(action_runner)
247 class Page14(ToughVideoCasesPage):
249 def __init__(self, page_set):
250 super(Page14, self).__init__(
251 url='file://tough_video_cases/video.html?src=tulip2.mp4',
254 self.add_browser_metrics = True
256 def RunMediaMetrics(self, action_runner):
257 self.PlayAction(action_runner)
260 class Page15(ToughVideoCasesPage):
262 def __init__(self, page_set):
263 super(Page15, self).__init__(
264 url='file://tough_video_cases/video.html?src=tulip2.m4a&type=audio',
267 self.add_browser_metrics = True
269 def RunMediaMetrics(self, action_runner):
270 self.PlayAction(action_runner)
273 class Page16(ToughVideoCasesPage):
275 def __init__(self, page_set):
276 super(Page16, self).__init__(
277 url='file://tough_video_cases/video.html?src=garden2_10s.webm',
281 self.add_browser_metrics = True
283 def RunMediaMetrics(self, action_runner):
284 self.PlayAction(action_runner)
287 class Page17(ToughVideoCasesPage):
289 def __init__(self, page_set):
290 super(Page17, self).__init__(
291 url='file://tough_video_cases/video.html?src=garden2_10s.mp4',
295 self.add_browser_metrics = True
297 def RunMediaMetrics(self, action_runner):
298 self.PlayAction(action_runner)
301 class Page18(ToughVideoCasesPage):
303 def __init__(self, page_set):
304 super(Page18, self).__init__(
305 url='file://tough_video_cases/video.html?src=garden2_10s.ogv',
309 self.add_browser_metrics = True
311 def RunMediaMetrics(self, action_runner):
312 self.PlayAction(action_runner)
315 class Page19(ToughVideoCasesPage):
317 def __init__(self, page_set):
318 super(Page19, self).__init__(
319 url='file://tough_video_cases/video.html?src=tulip2.ogg&type=audio',
322 self.skip_basic_metrics = True
324 def RunMediaMetrics(self, action_runner):
325 self.SeekBeforeAndAfterPlayhead(action_runner)
328 class Page20(ToughVideoCasesPage):
330 def __init__(self, page_set):
331 super(Page20, self).__init__(
332 url='file://tough_video_cases/video.html?src=tulip2.wav&type=audio',
335 self.skip_basic_metrics = True
337 def RunMediaMetrics(self, action_runner):
338 self.SeekBeforeAndAfterPlayhead(action_runner)
341 class Page21(ToughVideoCasesPage):
343 def __init__(self, page_set):
344 super(Page21, self).__init__(
345 url='file://tough_video_cases/video.html?src=tulip2.ogv',
348 self.skip_basic_metrics = True
350 def RunMediaMetrics(self, action_runner):
351 self.SeekBeforeAndAfterPlayhead(action_runner)
354 class Page22(ToughVideoCasesPage):
356 def __init__(self, page_set):
357 super(Page22, self).__init__(
358 url='file://tough_video_cases/video.html?src=tulip2.webm',
361 self.skip_basic_metrics = True
363 def RunMediaMetrics(self, action_runner):
364 self.SeekBeforeAndAfterPlayhead(action_runner)
367 class Page23(ToughVideoCasesPage):
369 def __init__(self, page_set):
370 super(Page23, self).__init__(
371 url='file://tough_video_cases/video.html?src=tulip2.mp3&type=audio',
374 self.skip_basic_metrics = True
376 def RunMediaMetrics(self, action_runner):
377 self.SeekBeforeAndAfterPlayhead(action_runner)
380 class Page24(ToughVideoCasesPage):
382 def __init__(self, page_set):
383 super(Page24, self).__init__(
384 url='file://tough_video_cases/video.html?src=tulip2.mp4',
387 self.skip_basic_metrics = True
389 def RunMediaMetrics(self, action_runner):
390 self.SeekBeforeAndAfterPlayhead(action_runner)
393 class Page25(ToughVideoCasesPage):
395 def __init__(self, page_set):
396 super(Page25, self).__init__(
397 url='file://tough_video_cases/video.html?src=garden2_10s.webm',
400 self.skip_basic_metrics = True
403 def RunMediaMetrics(self, action_runner):
404 self.SeekBeforeAndAfterPlayhead(action_runner)
407 class Page26(ToughVideoCasesPage):
409 def __init__(self, page_set):
410 super(Page26, self).__init__(
411 url='file://tough_video_cases/video.html?src=garden2_10s.mp4',
414 self.skip_basic_metrics = True
417 def RunMediaMetrics(self, action_runner):
418 self.SeekBeforeAndAfterPlayhead(action_runner)
421 class Page27(ToughVideoCasesPage):
423 def __init__(self, page_set):
424 super(Page27, self).__init__(
425 url='file://tough_video_cases/video.html?src=garden2_10s.ogv',
428 self.skip_basic_metrics = True
431 def RunMediaMetrics(self, action_runner):
432 self.SeekBeforeAndAfterPlayhead(action_runner)
435 class Page28(ToughVideoCasesPage):
437 def __init__(self, page_set):
438 super(Page28, self).__init__(
439 url='file://tough_video_cases/audio_playback.html?id=single_audio',
442 self.skip_basic_metrics = True
444 def RunMediaMetrics(self, action_runner):
445 self.LoopSingleAudio(action_runner)
448 class Page29(ToughVideoCasesPage):
450 def __init__(self, page_set):
451 super(Page29, self).__init__(
452 url='file://tough_video_cases/audio_playback.html?id=mixed_audio',
455 self.skip_basic_metrics = True
457 def RunMediaMetrics(self, action_runner):
458 self.LoopMixedAudio(action_runner)
461 class ToughVideoCasesPageSet(page_set_module.PageSet):
464 Description: Video Stack Perf benchmark
467 super(ToughVideoCasesPageSet, self).__init__()
469 self.AddPage(Page1(self))
470 self.AddPage(Page2(self))
471 self.AddPage(Page3(self))
472 self.AddPage(Page4(self))
473 self.AddPage(Page5(self))
474 self.AddPage(Page6(self))
475 self.AddPage(Page7(self))
476 self.AddPage(Page8(self))
477 self.AddPage(Page9(self))
478 self.AddPage(Page10(self))
479 self.AddPage(Page11(self))
480 self.AddPage(Page12(self))
481 self.AddPage(Page13(self))
482 self.AddPage(Page14(self))
483 self.AddPage(Page15(self))
484 self.AddPage(Page16(self))
485 self.AddPage(Page17(self))
486 self.AddPage(Page18(self))
487 self.AddPage(Page19(self))
488 self.AddPage(Page20(self))
489 self.AddPage(Page21(self))
490 self.AddPage(Page22(self))
491 self.AddPage(Page23(self))
492 self.AddPage(Page24(self))
493 self.AddPage(Page25(self))
494 self.AddPage(Page26(self))
495 self.AddPage(Page27(self))
496 self.AddPage(Page28(self))
497 self.AddPage(Page29(self))