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 6 7 8 class ToughVideoCasesPage(page_module.Page): 9 10 def __init__(self, url, page_set): 11 super(ToughVideoCasesPage, self).__init__(url=url, page_set=page_set) 12 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') 17 18 def LoopSingleAudio(self, action_runner): 19 action_runner.LoopMedia(loop_count=50, selector='#single_audio') 20 21 def PlayAction(self, action_runner): 22 action_runner.PlayMedia(playing_event_timeout_in_seconds=60, 23 ended_event_timeout_in_seconds=60) 24 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. 29 action_runner.Wait(1) 30 # Seek to before the play-head location. 31 action_runner.SeekMedia(seconds=0.5, timeout_in_seconds=60, 32 label='seek_warm') 33 # Seek to after the play-head location. 34 action_runner.SeekMedia(seconds=9, timeout_in_seconds=60, 35 label='seek_cold') 36 37 38 class Page1(ToughVideoCasesPage): 39 40 def __init__(self, page_set): 41 super(Page1, self).__init__( 42 url='file://tough_video_cases/video.html?src=crowd.wav&type=audio', 43 page_set=page_set) 44 45 self.add_browser_metrics = True 46 47 def RunMediaMetrics(self, action_runner): 48 self.PlayAction(action_runner) 49 50 51 class Page2(ToughVideoCasesPage): 52 53 def __init__(self, page_set): 54 super(Page2, self).__init__( 55 url='file://tough_video_cases/video.html?src=crowd.ogg&type=audio', 56 page_set=page_set) 57 58 self.add_browser_metrics = True 59 60 def RunMediaMetrics(self, action_runner): 61 self.PlayAction(action_runner) 62 63 64 class Page3(ToughVideoCasesPage): 65 66 def __init__(self, page_set): 67 super(Page3, self).__init__( 68 url='file://tough_video_cases/video.html?src=crowd1080.ogv', 69 page_set=page_set) 70 71 self.add_browser_metrics = True 72 self.is_50fps = True 73 74 def RunMediaMetrics(self, action_runner): 75 self.PlayAction(action_runner) 76 77 78 class Page4(ToughVideoCasesPage): 79 80 def __init__(self, page_set): 81 super(Page4, self).__init__( 82 url='file://tough_video_cases/video.html?src=crowd1080.webm', 83 page_set=page_set) 84 85 self.add_browser_metrics = True 86 self.is_50fps = True 87 88 def RunMediaMetrics(self, action_runner): 89 self.PlayAction(action_runner) 90 91 92 class Page5(ToughVideoCasesPage): 93 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) 98 99 self.add_browser_metrics = True 100 self.is_4k = True 101 self.is_50fps = True 102 103 def RunMediaMetrics(self, action_runner): 104 self.PlayAction(action_runner) 105 106 107 class Page6(ToughVideoCasesPage): 108 109 def __init__(self, page_set): 110 super(Page6, self).__init__( 111 url='file://tough_video_cases/video.html?src=crowd2160.webm', 112 page_set=page_set) 113 114 self.add_browser_metrics = True 115 self.is_4k = True 116 self.is_50fps = True 117 118 def RunMediaMetrics(self, action_runner): 119 self.PlayAction(action_runner) 120 121 122 class Page7(ToughVideoCasesPage): 123 124 def __init__(self, page_set): 125 super(Page7, self).__init__( 126 url='file://tough_video_cases/video.html?src=tulip2.ogg&type=audio', 127 page_set=page_set) 128 129 self.add_browser_metrics = True 130 131 def RunMediaMetrics(self, action_runner): 132 self.PlayAction(action_runner) 133 134 135 class Page8(ToughVideoCasesPage): 136 137 def __init__(self, page_set): 138 super(Page8, self).__init__( 139 url='file://tough_video_cases/video.html?src=tulip2.wav&type=audio', 140 page_set=page_set) 141 142 self.add_browser_metrics = True 143 144 def RunMediaMetrics(self, action_runner): 145 self.PlayAction(action_runner) 146 147 148 class Page9(ToughVideoCasesPage): 149 150 def __init__(self, page_set): 151 super(Page9, self).__init__( 152 url='file://tough_video_cases/video.html?src=tulip2.ogv', 153 page_set=page_set) 154 155 self.add_browser_metrics = True 156 157 def RunMediaMetrics(self, action_runner): 158 self.PlayAction(action_runner) 159 160 161 class Page10(ToughVideoCasesPage): 162 163 def __init__(self, page_set): 164 super(Page10, self).__init__( 165 url='file://tough_video_cases/video.html?src=tulip2.webm', 166 page_set=page_set) 167 168 self.add_browser_metrics = True 169 170 def RunMediaMetrics(self, action_runner): 171 self.PlayAction(action_runner) 172 173 174 class Page11(ToughVideoCasesPage): 175 176 def __init__(self, page_set): 177 super(Page11, self).__init__( 178 url='file://tough_video_cases/video.html?src=crowd1080.mp4', 179 page_set=page_set) 180 181 self.add_browser_metrics = True 182 self.is_50fps = True 183 184 def RunMediaMetrics(self, action_runner): 185 self.PlayAction(action_runner) 186 187 188 class Page12(ToughVideoCasesPage): 189 190 def __init__(self, page_set): 191 super(Page12, self).__init__( 192 url='file://tough_video_cases/video.html?src=crowd2160.mp4', 193 page_set=page_set) 194 195 self.add_browser_metrics = True 196 self.is_4k = True 197 self.is_50fps = True 198 199 def RunMediaMetrics(self, action_runner): 200 self.PlayAction(action_runner) 201 202 203 class Page13(ToughVideoCasesPage): 204 205 def __init__(self, page_set): 206 super(Page13, self).__init__( 207 url='file://tough_video_cases/video.html?src=tulip2.mp3&type=audio', 208 page_set=page_set) 209 210 self.add_browser_metrics = True 211 212 def RunMediaMetrics(self, action_runner): 213 self.PlayAction(action_runner) 214 215 216 class Page14(ToughVideoCasesPage): 217 218 def __init__(self, page_set): 219 super(Page14, self).__init__( 220 url='file://tough_video_cases/video.html?src=tulip2.mp4', 221 page_set=page_set) 222 223 self.add_browser_metrics = True 224 225 def RunMediaMetrics(self, action_runner): 226 self.PlayAction(action_runner) 227 228 229 class Page15(ToughVideoCasesPage): 230 231 def __init__(self, page_set): 232 super(Page15, self).__init__( 233 url='file://tough_video_cases/video.html?src=tulip2.m4a&type=audio', 234 page_set=page_set) 235 236 self.add_browser_metrics = True 237 238 def RunMediaMetrics(self, action_runner): 239 self.PlayAction(action_runner) 240 241 242 class Page16(ToughVideoCasesPage): 243 244 def __init__(self, page_set): 245 super(Page16, self).__init__( 246 url='file://tough_video_cases/video.html?src=garden2_10s.webm', 247 page_set=page_set) 248 249 self.is_4k = True 250 self.add_browser_metrics = True 251 252 def RunMediaMetrics(self, action_runner): 253 self.PlayAction(action_runner) 254 255 256 class Page17(ToughVideoCasesPage): 257 258 def __init__(self, page_set): 259 super(Page17, self).__init__( 260 url='file://tough_video_cases/video.html?src=garden2_10s.mp4', 261 page_set=page_set) 262 263 self.is_4k = True 264 self.add_browser_metrics = True 265 266 def RunMediaMetrics(self, action_runner): 267 self.PlayAction(action_runner) 268 269 270 class Page18(ToughVideoCasesPage): 271 272 def __init__(self, page_set): 273 super(Page18, self).__init__( 274 url='file://tough_video_cases/video.html?src=garden2_10s.ogv', 275 page_set=page_set) 276 277 self.is_4k = True 278 self.add_browser_metrics = True 279 280 def RunMediaMetrics(self, action_runner): 281 self.PlayAction(action_runner) 282 283 284 class Page19(ToughVideoCasesPage): 285 286 def __init__(self, page_set): 287 super(Page19, self).__init__( 288 url='file://tough_video_cases/video.html?src=tulip2.ogg&type=audio', 289 page_set=page_set) 290 291 self.skip_basic_metrics = True 292 293 def RunMediaMetrics(self, action_runner): 294 self.SeekBeforeAndAfterPlayhead(action_runner) 295 296 297 class Page20(ToughVideoCasesPage): 298 299 def __init__(self, page_set): 300 super(Page20, self).__init__( 301 url='file://tough_video_cases/video.html?src=tulip2.wav&type=audio', 302 page_set=page_set) 303 304 self.skip_basic_metrics = True 305 306 def RunMediaMetrics(self, action_runner): 307 self.SeekBeforeAndAfterPlayhead(action_runner) 308 309 310 class Page21(ToughVideoCasesPage): 311 312 def __init__(self, page_set): 313 super(Page21, self).__init__( 314 url='file://tough_video_cases/video.html?src=tulip2.ogv', 315 page_set=page_set) 316 317 self.skip_basic_metrics = True 318 319 def RunMediaMetrics(self, action_runner): 320 self.SeekBeforeAndAfterPlayhead(action_runner) 321 322 323 class Page22(ToughVideoCasesPage): 324 325 def __init__(self, page_set): 326 super(Page22, self).__init__( 327 url='file://tough_video_cases/video.html?src=tulip2.webm', 328 page_set=page_set) 329 330 self.skip_basic_metrics = True 331 332 def RunMediaMetrics(self, action_runner): 333 self.SeekBeforeAndAfterPlayhead(action_runner) 334 335 336 class Page23(ToughVideoCasesPage): 337 338 def __init__(self, page_set): 339 super(Page23, self).__init__( 340 url='file://tough_video_cases/video.html?src=tulip2.mp3&type=audio', 341 page_set=page_set) 342 343 self.skip_basic_metrics = True 344 345 def RunMediaMetrics(self, action_runner): 346 self.SeekBeforeAndAfterPlayhead(action_runner) 347 348 349 class Page24(ToughVideoCasesPage): 350 351 def __init__(self, page_set): 352 super(Page24, self).__init__( 353 url='file://tough_video_cases/video.html?src=tulip2.mp4', 354 page_set=page_set) 355 356 self.skip_basic_metrics = True 357 358 def RunMediaMetrics(self, action_runner): 359 self.SeekBeforeAndAfterPlayhead(action_runner) 360 361 362 class Page25(ToughVideoCasesPage): 363 364 def __init__(self, page_set): 365 super(Page25, self).__init__( 366 url='file://tough_video_cases/video.html?src=garden2_10s.webm', 367 page_set=page_set) 368 369 self.skip_basic_metrics = True 370 self.is_4k = True 371 372 def RunMediaMetrics(self, action_runner): 373 self.SeekBeforeAndAfterPlayhead(action_runner) 374 375 376 class Page26(ToughVideoCasesPage): 377 378 def __init__(self, page_set): 379 super(Page26, self).__init__( 380 url='file://tough_video_cases/video.html?src=garden2_10s.mp4', 381 page_set=page_set) 382 383 self.skip_basic_metrics = True 384 self.is_4k = True 385 386 def RunMediaMetrics(self, action_runner): 387 self.SeekBeforeAndAfterPlayhead(action_runner) 388 389 390 class Page27(ToughVideoCasesPage): 391 392 def __init__(self, page_set): 393 super(Page27, self).__init__( 394 url='file://tough_video_cases/video.html?src=garden2_10s.ogv', 395 page_set=page_set) 396 397 self.skip_basic_metrics = True 398 self.is_4k = True 399 400 def RunMediaMetrics(self, action_runner): 401 self.SeekBeforeAndAfterPlayhead(action_runner) 402 403 404 class Page28(ToughVideoCasesPage): 405 406 def __init__(self, page_set): 407 super(Page28, self).__init__( 408 url='file://tough_video_cases/audio_playback.html?id=single_audio', 409 page_set=page_set) 410 411 self.skip_basic_metrics = True 412 413 def RunMediaMetrics(self, action_runner): 414 self.LoopSingleAudio(action_runner) 415 416 417 class Page29(ToughVideoCasesPage): 418 419 def __init__(self, page_set): 420 super(Page29, self).__init__( 421 url='file://tough_video_cases/audio_playback.html?id=mixed_audio', 422 page_set=page_set) 423 424 self.skip_basic_metrics = True 425 426 def RunMediaMetrics(self, action_runner): 427 self.LoopMixedAudio(action_runner) 428 429 class Page30(ToughVideoCasesPage): 430 431 def __init__(self, page_set): 432 super(Page30, self).__init__( 433 url='file://tough_video_cases/video.html?src=tulip2.vp9.webm', 434 page_set=page_set) 435 436 self.add_browser_metrics = True 437 438 def RunMediaMetrics(self, action_runner): 439 self.PlayAction(action_runner) 440 441 class Page31(ToughVideoCasesPage): 442 443 def __init__(self, page_set): 444 super(Page31, self).__init__( 445 url='file://tough_video_cases/video.html?src=tulip2.vp9.webm', 446 page_set=page_set) 447 448 self.skip_basic_metrics = True 449 450 def RunMediaMetrics(self, action_runner): 451 self.SeekBeforeAndAfterPlayhead(action_runner) 452 453 class Page32(ToughVideoCasesPage): 454 455 def __init__(self, page_set): 456 super(Page32, self).__init__( 457 url='file://tough_video_cases/video.html?src=crowd1080_vp9.webm', 458 page_set=page_set) 459 460 self.add_browser_metrics = True 461 462 def RunMediaMetrics(self, action_runner): 463 self.PlayAction(action_runner) 464 465 class Page33(ToughVideoCasesPage): 466 467 def __init__(self, page_set): 468 super(Page33, self).__init__( 469 url='file://tough_video_cases/video.html?src=crowd1080_vp9.webm', 470 page_set=page_set) 471 472 self.skip_basic_metrics = True 473 474 def RunMediaMetrics(self, action_runner): 475 self.SeekBeforeAndAfterPlayhead(action_runner) 476 477 class Page34(ToughVideoCasesPage): 478 479 def __init__(self, page_set): 480 super(Page34, self).__init__( 481 url='file://tough_video_cases/video.html?src=crowd720_vp9.webm', 482 page_set=page_set) 483 484 self.add_browser_metrics = True 485 486 def RunMediaMetrics(self, action_runner): 487 self.PlayAction(action_runner) 488 489 class Page35(ToughVideoCasesPage): 490 491 def __init__(self, page_set): 492 super(Page35, self).__init__( 493 url='file://tough_video_cases/video.html?src=crowd720_vp9.webm', 494 page_set=page_set) 495 496 self.skip_basic_metrics = True 497 498 def RunMediaMetrics(self, action_runner): 499 self.SeekBeforeAndAfterPlayhead(action_runner) 500 501 class ToughVideoCasesPageSet(page_set_module.PageSet): 502 503 """ 504 Description: Video Stack Perf benchmark 505 """ 506 def __init__(self): 507 super(ToughVideoCasesPageSet, self).__init__( 508 bucket=page_set_module.INTERNAL_BUCKET) 509 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)) 545