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 from telemetry.page import page as page_module
5 from telemetry.page import page_set as page_set_module
8 class ToughVideoCasesPage(page_module.Page):
10 def __init__(self, url, page_set):
11 super(ToughVideoCasesPage, self).__init__(url=url, page_set=page_set)
13 def LoopMixedAudio(self, action_runner):
14 action_runner.PlayMedia(selector='#background_audio',
15 playing_event_timeout_in_seconds=60)
16 action_runner.LoopMedia(loop_count=50, selector='#mixed_audio')
18 def LoopSingleAudio(self, action_runner):
19 action_runner.LoopMedia(loop_count=50, selector='#single_audio')
21 def PlayAction(self, action_runner):
22 action_runner.PlayMedia(playing_event_timeout_in_seconds=60,
23 ended_event_timeout_in_seconds=60)
25 def SeekBeforeAndAfterPlayhead(self, action_runner):
26 action_runner.PlayMedia(playing_event_timeout_in_seconds=60,
27 ended_event_timeout_in_seconds=60)
28 # Wait for 1 second so that we know the play-head is at ~1s.
30 # Seek to before the play-head location.
31 action_runner.SeekMedia(seconds=0.5, timeout_in_seconds=60,
33 # Seek to after the play-head location.
34 action_runner.SeekMedia(seconds=9, timeout_in_seconds=60,
38 class Page1(ToughVideoCasesPage):
40 def __init__(self, page_set):
41 super(Page1, self).__init__(
42 url='file://tough_video_cases/video.html?src=crowd.wav&type=audio',
45 self.add_browser_metrics = True
47 def RunMediaMetrics(self, action_runner):
48 self.PlayAction(action_runner)
51 class Page2(ToughVideoCasesPage):
53 def __init__(self, page_set):
54 super(Page2, self).__init__(
55 url='file://tough_video_cases/video.html?src=crowd.ogg&type=audio',
58 self.add_browser_metrics = True
60 def RunMediaMetrics(self, action_runner):
61 self.PlayAction(action_runner)
64 class Page3(ToughVideoCasesPage):
66 def __init__(self, page_set):
67 super(Page3, self).__init__(
68 url='file://tough_video_cases/video.html?src=crowd1080.ogv',
71 self.add_browser_metrics = True
74 def RunMediaMetrics(self, action_runner):
75 self.PlayAction(action_runner)
78 class Page4(ToughVideoCasesPage):
80 def __init__(self, page_set):
81 super(Page4, self).__init__(
82 url='file://tough_video_cases/video.html?src=crowd1080.webm',
85 self.add_browser_metrics = True
88 def RunMediaMetrics(self, action_runner):
89 self.PlayAction(action_runner)
92 class Page5(ToughVideoCasesPage):
94 def __init__(self, page_set):
95 super(Page5, self).__init__(
96 url='file://tough_video_cases/video.html?src=crowd2160.ogv',
99 self.add_browser_metrics = True
103 def RunMediaMetrics(self, action_runner):
104 self.PlayAction(action_runner)
107 class Page6(ToughVideoCasesPage):
109 def __init__(self, page_set):
110 super(Page6, self).__init__(
111 url='file://tough_video_cases/video.html?src=crowd2160.webm',
114 self.add_browser_metrics = True
118 def RunMediaMetrics(self, action_runner):
119 self.PlayAction(action_runner)
122 class Page7(ToughVideoCasesPage):
124 def __init__(self, page_set):
125 super(Page7, self).__init__(
126 url='file://tough_video_cases/video.html?src=tulip2.ogg&type=audio',
129 self.add_browser_metrics = True
131 def RunMediaMetrics(self, action_runner):
132 self.PlayAction(action_runner)
135 class Page8(ToughVideoCasesPage):
137 def __init__(self, page_set):
138 super(Page8, self).__init__(
139 url='file://tough_video_cases/video.html?src=tulip2.wav&type=audio',
142 self.add_browser_metrics = True
144 def RunMediaMetrics(self, action_runner):
145 self.PlayAction(action_runner)
148 class Page9(ToughVideoCasesPage):
150 def __init__(self, page_set):
151 super(Page9, self).__init__(
152 url='file://tough_video_cases/video.html?src=tulip2.ogv',
155 self.add_browser_metrics = True
157 def RunMediaMetrics(self, action_runner):
158 self.PlayAction(action_runner)
161 class Page10(ToughVideoCasesPage):
163 def __init__(self, page_set):
164 super(Page10, self).__init__(
165 url='file://tough_video_cases/video.html?src=tulip2.webm',
168 self.add_browser_metrics = True
170 def RunMediaMetrics(self, action_runner):
171 self.PlayAction(action_runner)
174 class Page11(ToughVideoCasesPage):
176 def __init__(self, page_set):
177 super(Page11, self).__init__(
178 url='file://tough_video_cases/video.html?src=crowd1080.mp4',
181 self.add_browser_metrics = True
184 def RunMediaMetrics(self, action_runner):
185 self.PlayAction(action_runner)
188 class Page12(ToughVideoCasesPage):
190 def __init__(self, page_set):
191 super(Page12, self).__init__(
192 url='file://tough_video_cases/video.html?src=crowd2160.mp4',
195 self.add_browser_metrics = True
199 def RunMediaMetrics(self, action_runner):
200 self.PlayAction(action_runner)
203 class Page13(ToughVideoCasesPage):
205 def __init__(self, page_set):
206 super(Page13, self).__init__(
207 url='file://tough_video_cases/video.html?src=tulip2.mp3&type=audio',
210 self.add_browser_metrics = True
212 def RunMediaMetrics(self, action_runner):
213 self.PlayAction(action_runner)
216 class Page14(ToughVideoCasesPage):
218 def __init__(self, page_set):
219 super(Page14, self).__init__(
220 url='file://tough_video_cases/video.html?src=tulip2.mp4',
223 self.add_browser_metrics = True
225 def RunMediaMetrics(self, action_runner):
226 self.PlayAction(action_runner)
229 class Page15(ToughVideoCasesPage):
231 def __init__(self, page_set):
232 super(Page15, self).__init__(
233 url='file://tough_video_cases/video.html?src=tulip2.m4a&type=audio',
236 self.add_browser_metrics = True
238 def RunMediaMetrics(self, action_runner):
239 self.PlayAction(action_runner)
242 class Page16(ToughVideoCasesPage):
244 def __init__(self, page_set):
245 super(Page16, self).__init__(
246 url='file://tough_video_cases/video.html?src=garden2_10s.webm',
250 self.add_browser_metrics = True
252 def RunMediaMetrics(self, action_runner):
253 self.PlayAction(action_runner)
256 class Page17(ToughVideoCasesPage):
258 def __init__(self, page_set):
259 super(Page17, self).__init__(
260 url='file://tough_video_cases/video.html?src=garden2_10s.mp4',
264 self.add_browser_metrics = True
266 def RunMediaMetrics(self, action_runner):
267 self.PlayAction(action_runner)
270 class Page18(ToughVideoCasesPage):
272 def __init__(self, page_set):
273 super(Page18, self).__init__(
274 url='file://tough_video_cases/video.html?src=garden2_10s.ogv',
278 self.add_browser_metrics = True
280 def RunMediaMetrics(self, action_runner):
281 self.PlayAction(action_runner)
284 class Page19(ToughVideoCasesPage):
286 def __init__(self, page_set):
287 super(Page19, self).__init__(
288 url='file://tough_video_cases/video.html?src=tulip2.ogg&type=audio',
291 self.skip_basic_metrics = True
293 def RunMediaMetrics(self, action_runner):
294 self.SeekBeforeAndAfterPlayhead(action_runner)
297 class Page20(ToughVideoCasesPage):
299 def __init__(self, page_set):
300 super(Page20, self).__init__(
301 url='file://tough_video_cases/video.html?src=tulip2.wav&type=audio',
304 self.skip_basic_metrics = True
306 def RunMediaMetrics(self, action_runner):
307 self.SeekBeforeAndAfterPlayhead(action_runner)
310 class Page21(ToughVideoCasesPage):
312 def __init__(self, page_set):
313 super(Page21, self).__init__(
314 url='file://tough_video_cases/video.html?src=tulip2.ogv',
317 self.skip_basic_metrics = True
319 def RunMediaMetrics(self, action_runner):
320 self.SeekBeforeAndAfterPlayhead(action_runner)
323 class Page22(ToughVideoCasesPage):
325 def __init__(self, page_set):
326 super(Page22, self).__init__(
327 url='file://tough_video_cases/video.html?src=tulip2.webm',
330 self.skip_basic_metrics = True
332 def RunMediaMetrics(self, action_runner):
333 self.SeekBeforeAndAfterPlayhead(action_runner)
336 class Page23(ToughVideoCasesPage):
338 def __init__(self, page_set):
339 super(Page23, self).__init__(
340 url='file://tough_video_cases/video.html?src=tulip2.mp3&type=audio',
343 self.skip_basic_metrics = True
345 def RunMediaMetrics(self, action_runner):
346 self.SeekBeforeAndAfterPlayhead(action_runner)
349 class Page24(ToughVideoCasesPage):
351 def __init__(self, page_set):
352 super(Page24, self).__init__(
353 url='file://tough_video_cases/video.html?src=tulip2.mp4',
356 self.skip_basic_metrics = True
358 def RunMediaMetrics(self, action_runner):
359 self.SeekBeforeAndAfterPlayhead(action_runner)
362 class Page25(ToughVideoCasesPage):
364 def __init__(self, page_set):
365 super(Page25, self).__init__(
366 url='file://tough_video_cases/video.html?src=garden2_10s.webm',
369 self.skip_basic_metrics = True
372 def RunMediaMetrics(self, action_runner):
373 self.SeekBeforeAndAfterPlayhead(action_runner)
376 class Page26(ToughVideoCasesPage):
378 def __init__(self, page_set):
379 super(Page26, self).__init__(
380 url='file://tough_video_cases/video.html?src=garden2_10s.mp4',
383 self.skip_basic_metrics = True
386 def RunMediaMetrics(self, action_runner):
387 self.SeekBeforeAndAfterPlayhead(action_runner)
390 class Page27(ToughVideoCasesPage):
392 def __init__(self, page_set):
393 super(Page27, self).__init__(
394 url='file://tough_video_cases/video.html?src=garden2_10s.ogv',
397 self.skip_basic_metrics = True
400 def RunMediaMetrics(self, action_runner):
401 self.SeekBeforeAndAfterPlayhead(action_runner)
404 class Page28(ToughVideoCasesPage):
406 def __init__(self, page_set):
407 super(Page28, self).__init__(
408 url='file://tough_video_cases/audio_playback.html?id=single_audio',
411 self.skip_basic_metrics = True
413 def RunMediaMetrics(self, action_runner):
414 self.LoopSingleAudio(action_runner)
417 class Page29(ToughVideoCasesPage):
419 def __init__(self, page_set):
420 super(Page29, self).__init__(
421 url='file://tough_video_cases/audio_playback.html?id=mixed_audio',
424 self.skip_basic_metrics = True
426 def RunMediaMetrics(self, action_runner):
427 self.LoopMixedAudio(action_runner)
429 class Page30(ToughVideoCasesPage):
431 def __init__(self, page_set):
432 super(Page30, self).__init__(
433 url='file://tough_video_cases/video.html?src=tulip2.vp9.webm',
436 self.add_browser_metrics = True
438 def RunMediaMetrics(self, action_runner):
439 self.PlayAction(action_runner)
441 class Page31(ToughVideoCasesPage):
443 def __init__(self, page_set):
444 super(Page31, self).__init__(
445 url='file://tough_video_cases/video.html?src=tulip2.vp9.webm',
448 self.skip_basic_metrics = True
450 def RunMediaMetrics(self, action_runner):
451 self.SeekBeforeAndAfterPlayhead(action_runner)
453 class Page32(ToughVideoCasesPage):
455 def __init__(self, page_set):
456 super(Page32, self).__init__(
457 url='file://tough_video_cases/video.html?src=crowd1080_vp9.webm',
460 self.add_browser_metrics = True
462 def RunMediaMetrics(self, action_runner):
463 self.PlayAction(action_runner)
465 class Page33(ToughVideoCasesPage):
467 def __init__(self, page_set):
468 super(Page33, self).__init__(
469 url='file://tough_video_cases/video.html?src=crowd1080_vp9.webm',
472 self.skip_basic_metrics = True
474 def RunMediaMetrics(self, action_runner):
475 self.SeekBeforeAndAfterPlayhead(action_runner)
477 class Page34(ToughVideoCasesPage):
479 def __init__(self, page_set):
480 super(Page34, self).__init__(
481 url='file://tough_video_cases/video.html?src=crowd720_vp9.webm',
484 self.add_browser_metrics = True
486 def RunMediaMetrics(self, action_runner):
487 self.PlayAction(action_runner)
489 class Page35(ToughVideoCasesPage):
491 def __init__(self, page_set):
492 super(Page35, self).__init__(
493 url='file://tough_video_cases/video.html?src=crowd720_vp9.webm',
496 self.skip_basic_metrics = True
498 def RunMediaMetrics(self, action_runner):
499 self.SeekBeforeAndAfterPlayhead(action_runner)
501 class ToughVideoCasesPageSet(page_set_module.PageSet):
504 Description: Video Stack Perf benchmark
507 super(ToughVideoCasesPageSet, self).__init__(
508 bucket=page_set_module.INTERNAL_BUCKET)
510 self.AddPage(Page1(self))
511 self.AddPage(Page2(self))
512 self.AddPage(Page3(self))
513 self.AddPage(Page4(self))
514 self.AddPage(Page5(self))
515 self.AddPage(Page6(self))
516 self.AddPage(Page7(self))
517 self.AddPage(Page8(self))
518 self.AddPage(Page9(self))
519 self.AddPage(Page10(self))
520 self.AddPage(Page11(self))
521 self.AddPage(Page12(self))
522 self.AddPage(Page13(self))
523 self.AddPage(Page14(self))
524 self.AddPage(Page15(self))
525 self.AddPage(Page16(self))
526 self.AddPage(Page17(self))
527 self.AddPage(Page18(self))
528 self.AddPage(Page19(self))
529 self.AddPage(Page20(self))
530 self.AddPage(Page21(self))
531 self.AddPage(Page22(self))
532 self.AddPage(Page23(self))
533 self.AddPage(Page24(self))
534 self.AddPage(Page25(self))
535 self.AddPage(Page26(self))
536 self.AddPage(Page27(self))
537 self.AddPage(Page28(self))
538 self.AddPage(Page29(self))
539 self.AddPage(Page30(self))
540 self.AddPage(Page31(self))
541 self.AddPage(Page32(self))
542 self.AddPage(Page33(self))
543 self.AddPage(Page34(self))
544 self.AddPage(Page35(self))