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
import story
8 class ToughVideoCasesPage(page_module
.Page
):
10 def __init__(self
, url
, page_set
, labels
=None):
11 super(ToughVideoCasesPage
, self
).__init
__(
12 url
=url
, page_set
=page_set
, labels
=labels
)
14 def LoopMixedAudio(self
, action_runner
):
15 action_runner
.PlayMedia(selector
='#background_audio',
16 playing_event_timeout_in_seconds
=60)
17 action_runner
.LoopMedia(loop_count
=50, selector
='#mixed_audio')
19 def LoopSingleAudio(self
, action_runner
):
20 action_runner
.LoopMedia(loop_count
=50, selector
='#single_audio')
22 def PlayAction(self
, action_runner
):
23 action_runner
.PlayMedia(playing_event_timeout_in_seconds
=60,
24 ended_event_timeout_in_seconds
=60)
26 def SeekBeforeAndAfterPlayhead(self
, action_runner
):
27 action_runner
.PlayMedia(playing_event_timeout_in_seconds
=60,
28 ended_event_timeout_in_seconds
=60)
29 # Wait for 1 second so that we know the play-head is at ~1s.
31 # Seek to before the play-head location.
32 action_runner
.SeekMedia(seconds
=0.5, timeout_in_seconds
=60,
34 # Seek to after the play-head location.
35 action_runner
.SeekMedia(seconds
=9, timeout_in_seconds
=60,
39 class Page1(ToughVideoCasesPage
):
41 def __init__(self
, page_set
):
42 super(Page1
, self
).__init
__(
43 url
='file://tough_video_cases/video.html?src=crowd.wav&type=audio',
46 self
.add_browser_metrics
= True
48 def RunPageInteractions(self
, action_runner
):
49 self
.PlayAction(action_runner
)
52 class Page2(ToughVideoCasesPage
):
54 def __init__(self
, page_set
):
55 super(Page2
, self
).__init
__(
56 url
='file://tough_video_cases/video.html?src=crowd.ogg&type=audio',
59 self
.add_browser_metrics
= True
61 def RunPageInteractions(self
, action_runner
):
62 self
.PlayAction(action_runner
)
65 class Page3(ToughVideoCasesPage
):
67 def __init__(self
, page_set
):
68 super(Page3
, self
).__init
__(
69 url
='file://tough_video_cases/video.html?src=crowd1080.ogv',
72 self
.add_browser_metrics
= True
75 def RunPageInteractions(self
, action_runner
):
76 self
.PlayAction(action_runner
)
79 class Page4(ToughVideoCasesPage
):
81 def __init__(self
, page_set
):
82 super(Page4
, self
).__init
__(
83 url
='file://tough_video_cases/video.html?src=crowd1080.webm',
84 page_set
=page_set
, labels
=['is_50fps'])
86 self
.add_browser_metrics
= True
88 def RunPageInteractions(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',
97 page_set
=page_set
, labels
=['is_4k', 'is_50fps'])
99 self
.add_browser_metrics
= True
101 def RunPageInteractions(self
, action_runner
):
102 self
.PlayAction(action_runner
)
105 class Page6(ToughVideoCasesPage
):
107 def __init__(self
, page_set
):
108 super(Page6
, self
).__init
__(
109 url
='file://tough_video_cases/video.html?src=crowd2160.webm',
110 page_set
=page_set
, labels
=['is_4k', 'is_50fps'])
112 self
.add_browser_metrics
= True
114 def RunPageInteractions(self
, action_runner
):
115 self
.PlayAction(action_runner
)
118 class Page7(ToughVideoCasesPage
):
120 def __init__(self
, page_set
):
121 super(Page7
, self
).__init
__(
122 url
='file://tough_video_cases/video.html?src=tulip2.ogg&type=audio',
125 self
.add_browser_metrics
= True
127 def RunPageInteractions(self
, action_runner
):
128 self
.PlayAction(action_runner
)
131 class Page8(ToughVideoCasesPage
):
133 def __init__(self
, page_set
):
134 super(Page8
, self
).__init
__(
135 url
='file://tough_video_cases/video.html?src=tulip2.wav&type=audio',
138 self
.add_browser_metrics
= True
140 def RunPageInteractions(self
, action_runner
):
141 self
.PlayAction(action_runner
)
144 class Page9(ToughVideoCasesPage
):
146 def __init__(self
, page_set
):
147 super(Page9
, self
).__init
__(
148 url
='file://tough_video_cases/video.html?src=tulip2.ogv',
151 self
.add_browser_metrics
= True
153 def RunPageInteractions(self
, action_runner
):
154 self
.PlayAction(action_runner
)
157 class Page10(ToughVideoCasesPage
):
159 def __init__(self
, page_set
):
160 super(Page10
, self
).__init
__(
161 url
='file://tough_video_cases/video.html?src=tulip2.webm',
164 self
.add_browser_metrics
= True
166 def RunPageInteractions(self
, action_runner
):
167 self
.PlayAction(action_runner
)
170 class Page11(ToughVideoCasesPage
):
172 def __init__(self
, page_set
):
173 super(Page11
, self
).__init
__(
174 url
='file://tough_video_cases/video.html?src=crowd1080.mp4',
175 page_set
=page_set
, labels
=['is_50fps'])
177 self
.add_browser_metrics
= True
179 def RunPageInteractions(self
, action_runner
):
180 self
.PlayAction(action_runner
)
183 class Page12(ToughVideoCasesPage
):
185 def __init__(self
, page_set
):
186 super(Page12
, self
).__init
__(
187 url
='file://tough_video_cases/video.html?src=crowd2160.mp4',
188 page_set
=page_set
, labels
=['is_4k', 'is_50fps'])
190 self
.add_browser_metrics
= True
192 def RunPageInteractions(self
, action_runner
):
193 self
.PlayAction(action_runner
)
196 class Page13(ToughVideoCasesPage
):
198 def __init__(self
, page_set
):
199 super(Page13
, self
).__init
__(
200 url
='file://tough_video_cases/video.html?src=tulip2.mp3&type=audio',
203 self
.add_browser_metrics
= True
205 def RunPageInteractions(self
, action_runner
):
206 self
.PlayAction(action_runner
)
209 class Page14(ToughVideoCasesPage
):
211 def __init__(self
, page_set
):
212 super(Page14
, self
).__init
__(
213 url
='file://tough_video_cases/video.html?src=tulip2.mp4',
216 self
.add_browser_metrics
= True
218 def RunPageInteractions(self
, action_runner
):
219 self
.PlayAction(action_runner
)
222 class Page15(ToughVideoCasesPage
):
224 def __init__(self
, page_set
):
225 super(Page15
, self
).__init
__(
226 url
='file://tough_video_cases/video.html?src=tulip2.m4a&type=audio',
229 self
.add_browser_metrics
= True
231 def RunPageInteractions(self
, action_runner
):
232 self
.PlayAction(action_runner
)
235 class Page16(ToughVideoCasesPage
):
237 def __init__(self
, page_set
):
238 super(Page16
, self
).__init
__(
239 url
='file://tough_video_cases/video.html?src=garden2_10s.webm',
240 page_set
=page_set
, labels
=['is_4k'])
242 self
.add_browser_metrics
= True
244 def RunPageInteractions(self
, action_runner
):
245 self
.PlayAction(action_runner
)
248 class Page17(ToughVideoCasesPage
):
250 def __init__(self
, page_set
):
251 super(Page17
, self
).__init
__(
252 url
='file://tough_video_cases/video.html?src=garden2_10s.mp4',
253 page_set
=page_set
, labels
=['is_4k'])
255 self
.add_browser_metrics
= True
257 def RunPageInteractions(self
, action_runner
):
258 self
.PlayAction(action_runner
)
261 class Page18(ToughVideoCasesPage
):
263 def __init__(self
, page_set
):
264 super(Page18
, self
).__init
__(
265 url
='file://tough_video_cases/video.html?src=garden2_10s.ogv',
266 page_set
=page_set
, labels
=['is_4k'])
268 self
.add_browser_metrics
= True
270 def RunPageInteractions(self
, action_runner
):
271 self
.PlayAction(action_runner
)
274 class Page19(ToughVideoCasesPage
):
276 def __init__(self
, page_set
):
277 super(Page19
, self
).__init
__(
278 url
='file://tough_video_cases/video.html?src=tulip2.ogg&type=audio',
281 self
.skip_basic_metrics
= True
283 def RunPageInteractions(self
, action_runner
):
284 self
.SeekBeforeAndAfterPlayhead(action_runner
)
287 class Page20(ToughVideoCasesPage
):
289 def __init__(self
, page_set
):
290 super(Page20
, self
).__init
__(
291 url
='file://tough_video_cases/video.html?src=tulip2.wav&type=audio',
294 self
.skip_basic_metrics
= True
296 def RunPageInteractions(self
, action_runner
):
297 self
.SeekBeforeAndAfterPlayhead(action_runner
)
300 class Page21(ToughVideoCasesPage
):
302 def __init__(self
, page_set
):
303 super(Page21
, self
).__init
__(
304 url
='file://tough_video_cases/video.html?src=tulip2.ogv',
307 self
.skip_basic_metrics
= True
309 def RunPageInteractions(self
, action_runner
):
310 self
.SeekBeforeAndAfterPlayhead(action_runner
)
313 class Page22(ToughVideoCasesPage
):
315 def __init__(self
, page_set
):
316 super(Page22
, self
).__init
__(
317 url
='file://tough_video_cases/video.html?src=tulip2.webm',
320 self
.skip_basic_metrics
= True
322 def RunPageInteractions(self
, action_runner
):
323 self
.SeekBeforeAndAfterPlayhead(action_runner
)
326 class Page23(ToughVideoCasesPage
):
328 def __init__(self
, page_set
):
329 super(Page23
, self
).__init
__(
330 url
='file://tough_video_cases/video.html?src=tulip2.mp3&type=audio',
333 self
.skip_basic_metrics
= True
335 def RunPageInteractions(self
, action_runner
):
336 self
.SeekBeforeAndAfterPlayhead(action_runner
)
339 class Page24(ToughVideoCasesPage
):
341 def __init__(self
, page_set
):
342 super(Page24
, self
).__init
__(
343 url
='file://tough_video_cases/video.html?src=tulip2.mp4',
346 self
.skip_basic_metrics
= True
348 def RunPageInteractions(self
, action_runner
):
349 self
.SeekBeforeAndAfterPlayhead(action_runner
)
352 class Page25(ToughVideoCasesPage
):
354 def __init__(self
, page_set
):
355 super(Page25
, self
).__init
__(
356 url
='file://tough_video_cases/video.html?src=garden2_10s.webm',
357 page_set
=page_set
, labels
=['is_4k'])
359 self
.skip_basic_metrics
= True
361 def RunPageInteractions(self
, action_runner
):
362 self
.SeekBeforeAndAfterPlayhead(action_runner
)
365 class Page26(ToughVideoCasesPage
):
367 def __init__(self
, page_set
):
368 super(Page26
, self
).__init
__(
369 url
='file://tough_video_cases/video.html?src=garden2_10s.mp4',
370 page_set
=page_set
, labels
=['is_4k'])
372 self
.skip_basic_metrics
= True
374 def RunPageInteractions(self
, action_runner
):
375 self
.SeekBeforeAndAfterPlayhead(action_runner
)
378 class Page27(ToughVideoCasesPage
):
380 def __init__(self
, page_set
):
381 super(Page27
, self
).__init
__(
382 url
='file://tough_video_cases/video.html?src=garden2_10s.ogv',
383 page_set
=page_set
, labels
=['is_4k'])
385 self
.skip_basic_metrics
= True
387 def RunPageInteractions(self
, action_runner
):
388 self
.SeekBeforeAndAfterPlayhead(action_runner
)
391 class Page28(ToughVideoCasesPage
):
393 def __init__(self
, page_set
):
394 super(Page28
, self
).__init
__(
395 url
='file://tough_video_cases/audio_playback.html?id=single_audio',
398 self
.skip_basic_metrics
= True
400 def RunPageInteractions(self
, action_runner
):
401 self
.LoopSingleAudio(action_runner
)
404 class Page29(ToughVideoCasesPage
):
406 def __init__(self
, page_set
):
407 super(Page29
, self
).__init
__(
408 url
='file://tough_video_cases/audio_playback.html?id=mixed_audio',
411 self
.skip_basic_metrics
= True
413 def RunPageInteractions(self
, action_runner
):
414 self
.LoopMixedAudio(action_runner
)
416 class Page30(ToughVideoCasesPage
):
418 def __init__(self
, page_set
):
419 super(Page30
, self
).__init
__(
420 url
='file://tough_video_cases/video.html?src=tulip2.vp9.webm',
423 self
.add_browser_metrics
= True
425 def RunPageInteractions(self
, action_runner
):
426 self
.PlayAction(action_runner
)
428 class Page31(ToughVideoCasesPage
):
430 def __init__(self
, page_set
):
431 super(Page31
, self
).__init
__(
432 url
='file://tough_video_cases/video.html?src=tulip2.vp9.webm',
435 self
.skip_basic_metrics
= True
437 def RunPageInteractions(self
, action_runner
):
438 self
.SeekBeforeAndAfterPlayhead(action_runner
)
440 class Page32(ToughVideoCasesPage
):
442 def __init__(self
, page_set
):
443 super(Page32
, self
).__init
__(
444 url
='file://tough_video_cases/video.html?src=crowd1080_vp9.webm',
447 self
.add_browser_metrics
= True
449 def RunPageInteractions(self
, action_runner
):
450 self
.PlayAction(action_runner
)
452 class Page33(ToughVideoCasesPage
):
454 def __init__(self
, page_set
):
455 super(Page33
, self
).__init
__(
456 url
='file://tough_video_cases/video.html?src=crowd1080_vp9.webm',
459 self
.skip_basic_metrics
= True
461 def RunPageInteractions(self
, action_runner
):
462 self
.SeekBeforeAndAfterPlayhead(action_runner
)
464 class Page34(ToughVideoCasesPage
):
466 def __init__(self
, page_set
):
467 super(Page34
, self
).__init
__(
468 url
='file://tough_video_cases/video.html?src=crowd720_vp9.webm',
471 self
.add_browser_metrics
= True
473 def RunPageInteractions(self
, action_runner
):
474 self
.PlayAction(action_runner
)
476 class Page35(ToughVideoCasesPage
):
478 def __init__(self
, page_set
):
479 super(Page35
, self
).__init
__(
480 url
='file://tough_video_cases/video.html?src=crowd720_vp9.webm',
483 self
.skip_basic_metrics
= True
485 def RunPageInteractions(self
, action_runner
):
486 self
.SeekBeforeAndAfterPlayhead(action_runner
)
488 class Page36(ToughVideoCasesPage
):
490 def __init__(self
, page_set
):
491 super(Page36
, self
).__init
__(
492 url
=('file://tough_video_cases/video.html?src='
493 'smpte_3840x2160_60fps_vp9.webm'),
496 self
.add_browser_metrics
= True
498 def RunPageInteractions(self
, action_runner
):
499 self
.SeekBeforeAndAfterPlayhead(action_runner
)
501 class Page37(ToughVideoCasesPage
):
503 def __init__(self
, page_set
):
504 super(Page37
, self
).__init
__(
505 url
='file://tough_video_cases/video.html?src=crowd1080_vp9.webm&canvas=true',
508 self
.add_browser_metrics
= True
510 def RunPageInteractions(self
, action_runner
):
511 self
.PlayAction(action_runner
)
513 class Page38(ToughVideoCasesPage
):
515 def __init__(self
, page_set
):
516 super(Page38
, self
).__init
__(
517 url
='file://tough_video_cases/video.html?src=tulip2.mp4&canvas=true',
520 self
.add_browser_metrics
= True
522 def RunPageInteractions(self
, action_runner
):
523 self
.SeekBeforeAndAfterPlayhead(action_runner
)
525 class Page39(ToughVideoCasesPage
):
527 def __init__(self
, page_set
):
528 super(Page39
, self
).__init
__(
529 url
='file://tough_video_cases/video.html?src=garden2_10s.webm&canvas=true',
530 page_set
=page_set
, labels
=['is_4k'])
532 self
.add_browser_metrics
= True
534 def RunPageInteractions(self
, action_runner
):
535 self
.PlayAction(action_runner
)
537 class Page40(ToughVideoCasesPage
):
539 def __init__(self
, page_set
):
540 super(Page40
, self
).__init
__(
541 url
='file://tough_video_cases/video.html?src=crowd1080.ogv&canvas=true',
544 self
.add_browser_metrics
= True
547 def RunPageInteractions(self
, action_runner
):
548 self
.PlayAction(action_runner
)
550 class ToughVideoCasesPageSet(story
.StorySet
):
552 Description: Video Stack Perf benchmark
555 super(ToughVideoCasesPageSet
, self
).__init
__(
556 cloud_storage_bucket
=story
.PARTNER_BUCKET
)
558 self
.AddStory(Page1(self
))
559 self
.AddStory(Page2(self
))
560 self
.AddStory(Page3(self
))
561 self
.AddStory(Page4(self
))
562 self
.AddStory(Page5(self
))
563 self
.AddStory(Page6(self
))
564 self
.AddStory(Page7(self
))
565 self
.AddStory(Page8(self
))
566 self
.AddStory(Page9(self
))
567 self
.AddStory(Page10(self
))
568 self
.AddStory(Page11(self
))
569 self
.AddStory(Page12(self
))
570 self
.AddStory(Page13(self
))
571 self
.AddStory(Page14(self
))
572 self
.AddStory(Page15(self
))
573 self
.AddStory(Page16(self
))
574 self
.AddStory(Page17(self
))
575 self
.AddStory(Page18(self
))
576 self
.AddStory(Page19(self
))
577 self
.AddStory(Page20(self
))
578 self
.AddStory(Page21(self
))
579 self
.AddStory(Page22(self
))
580 self
.AddStory(Page23(self
))
581 self
.AddStory(Page24(self
))
582 self
.AddStory(Page25(self
))
583 self
.AddStory(Page26(self
))
584 self
.AddStory(Page27(self
))
585 self
.AddStory(Page28(self
))
586 self
.AddStory(Page29(self
))
587 self
.AddStory(Page30(self
))
588 self
.AddStory(Page31(self
))
589 self
.AddStory(Page32(self
))
590 self
.AddStory(Page33(self
))
591 self
.AddStory(Page34(self
))
592 self
.AddStory(Page35(self
))
593 self
.AddStory(Page36(self
))
594 self
.AddStory(Page37(self
))
595 self
.AddStory(Page38(self
))
596 self
.AddStory(Page39(self
))
597 self
.AddStory(Page40(self
))