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
, 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 ToughVideoCasesPageSet(page_set_module
.PageSet
):
491 Description: Video Stack Perf benchmark
494 super(ToughVideoCasesPageSet
, self
).__init
__(
495 bucket
=page_set_module
.INTERNAL_BUCKET
)
497 self
.AddPage(Page1(self
))
498 self
.AddPage(Page2(self
))
499 self
.AddPage(Page3(self
))
500 self
.AddPage(Page4(self
))
501 self
.AddPage(Page5(self
))
502 self
.AddPage(Page6(self
))
503 self
.AddPage(Page7(self
))
504 self
.AddPage(Page8(self
))
505 self
.AddPage(Page9(self
))
506 self
.AddPage(Page10(self
))
507 self
.AddPage(Page11(self
))
508 self
.AddPage(Page12(self
))
509 self
.AddPage(Page13(self
))
510 self
.AddPage(Page14(self
))
511 self
.AddPage(Page15(self
))
512 self
.AddPage(Page16(self
))
513 self
.AddPage(Page17(self
))
514 self
.AddPage(Page18(self
))
515 self
.AddPage(Page19(self
))
516 self
.AddPage(Page20(self
))
517 self
.AddPage(Page21(self
))
518 self
.AddPage(Page22(self
))
519 self
.AddPage(Page23(self
))
520 self
.AddPage(Page24(self
))
521 self
.AddPage(Page25(self
))
522 self
.AddPage(Page26(self
))
523 self
.AddPage(Page27(self
))
524 self
.AddPage(Page28(self
))
525 self
.AddPage(Page29(self
))
526 self
.AddPage(Page30(self
))
527 self
.AddPage(Page31(self
))
528 self
.AddPage(Page32(self
))
529 self
.AddPage(Page33(self
))
530 self
.AddPage(Page34(self
))
531 self
.AddPage(Page35(self
))