OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 # pylint: disable=W0401,W0614 | 4 # pylint: disable=W0401,W0614 |
5 from telemetry.page.actions.all_page_actions import * | 5 from telemetry.page.actions.all_page_actions import * |
6 from telemetry.page import page as page_module | 6 from telemetry.page import page as page_module |
7 from telemetry.page import page_set as page_set_module | 7 from telemetry.page import page_set as page_set_module |
8 from telemetry.web_perf import timeline_interaction_record as tir_module | 8 from telemetry.web_perf import timeline_interaction_record as tir_module |
9 | 9 |
10 | 10 |
11 class KeySilkCasesPage(page_module.Page): | 11 class KeySilkCasesPage(page_module.Page): |
12 | 12 |
13 def __init__(self, url, page_set): | 13 def __init__(self, url, page_set): |
14 super(KeySilkCasesPage, self).__init__(url=url, page_set=page_set) | 14 super(KeySilkCasesPage, self).__init__(url=url, page_set=page_set) |
15 self.credentials_path = 'data/credentials.json' | 15 self.credentials_path = 'data/credentials.json' |
16 self.user_agent_type = 'mobile' | 16 self.user_agent_type = 'mobile' |
17 self.archive_data_file = 'data/key_silk_cases.json' | 17 self.archive_data_file = 'data/key_silk_cases.json' |
18 | 18 |
19 def RunNavigateSteps(self, action_runner): | 19 def RunNavigateSteps(self, action_runner): |
20 action_runner.RunAction(NavigateAction()) | 20 action_runner.NavigateToPage(self) |
21 action_runner.RunAction(WaitAction( | 21 action_runner.RunAction(WaitAction( |
22 { | 22 { |
23 'seconds': 2 | 23 'seconds': 2 |
24 })) | 24 })) |
25 | 25 |
26 def RunSmoothness(self, action_runner): | 26 def RunSmoothness(self, action_runner): |
27 action_runner.RunAction(ScrollAction()) | 27 action_runner.RunAction(ScrollAction()) |
28 | 28 |
29 | 29 |
30 class Page1(KeySilkCasesPage): | 30 class Page1(KeySilkCasesPage): |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 276 |
277 | 277 |
278 class Page16(KeySilkCasesPage): | 278 class Page16(KeySilkCasesPage): |
279 | 279 |
280 def __init__(self, page_set): | 280 def __init__(self, page_set): |
281 super(Page16, self).__init__( | 281 super(Page16, self).__init__( |
282 url='file://key_silk_cases/inbox_app.html?swipe_to_dismiss', | 282 url='file://key_silk_cases/inbox_app.html?swipe_to_dismiss', |
283 page_set=page_set) | 283 page_set=page_set) |
284 | 284 |
285 def RunNavigateSteps(self, action_runner): | 285 def RunNavigateSteps(self, action_runner): |
286 action_runner.RunAction(NavigateAction()) | 286 action_runner.NavigateToPage(self) |
287 action_runner.RunAction(WaitAction({'seconds': 2})) | 287 action_runner.RunAction(WaitAction({'seconds': 2})) |
288 | 288 |
289 def SwipeToDismiss(self, action_runner): | 289 def SwipeToDismiss(self, action_runner): |
290 action_runner.RunAction(SwipeAction( | 290 action_runner.RunAction(SwipeAction( |
291 { | 291 { |
292 'left_start_percentage': 0.8, | 292 'left_start_percentage': 0.8, |
293 'distance': 200, | 293 'distance': 200, |
294 'direction': 'left', | 294 'direction': 'left', |
295 'top_start_percentage': 0.2, | 295 'top_start_percentage': 0.2, |
296 'element_function': ''' | 296 'element_function': ''' |
(...skipping 13 matching lines...) Expand all Loading... |
310 | 310 |
311 | 311 |
312 class Page17(KeySilkCasesPage): | 312 class Page17(KeySilkCasesPage): |
313 | 313 |
314 def __init__(self, page_set): | 314 def __init__(self, page_set): |
315 super(Page17, self).__init__( | 315 super(Page17, self).__init__( |
316 url='file://key_silk_cases/inbox_app.html?stress_hidey_bars', | 316 url='file://key_silk_cases/inbox_app.html?stress_hidey_bars', |
317 page_set=page_set) | 317 page_set=page_set) |
318 | 318 |
319 def RunNavigateSteps(self, action_runner): | 319 def RunNavigateSteps(self, action_runner): |
320 action_runner.RunAction(NavigateAction()) | 320 action_runner.NavigateToPage(self) |
321 action_runner.RunAction(WaitAction({'seconds': 2})) | 321 action_runner.RunAction(WaitAction({'seconds': 2})) |
322 | 322 |
323 def RunSmoothness(self, action_runner): | 323 def RunSmoothness(self, action_runner): |
324 self.StressHideyBars(action_runner) | 324 self.StressHideyBars(action_runner) |
325 | 325 |
326 def StressHideyBars(self, action_runner): | 326 def StressHideyBars(self, action_runner): |
327 action_runner.RunAction(ScrollAction( | 327 action_runner.RunAction(ScrollAction( |
328 { | 328 { |
329 'direction': 'down', | 329 'direction': 'down', |
330 'speed': 200, | 330 'speed': 200, |
(...skipping 23 matching lines...) Expand all Loading... |
354 | 354 |
355 | 355 |
356 class Page18(KeySilkCasesPage): | 356 class Page18(KeySilkCasesPage): |
357 | 357 |
358 def __init__(self, page_set): | 358 def __init__(self, page_set): |
359 super(Page18, self).__init__( | 359 super(Page18, self).__init__( |
360 url='file://key_silk_cases/inbox_app.html?toggle_drawer', | 360 url='file://key_silk_cases/inbox_app.html?toggle_drawer', |
361 page_set=page_set) | 361 page_set=page_set) |
362 | 362 |
363 def RunNavigateSteps(self, action_runner): | 363 def RunNavigateSteps(self, action_runner): |
364 action_runner.RunAction(NavigateAction()) | 364 action_runner.NavigateToPage(self) |
365 action_runner.RunAction(WaitAction( | 365 action_runner.RunAction(WaitAction( |
366 { | 366 { |
367 'seconds': 2 | 367 'seconds': 2 |
368 })) | 368 })) |
369 | 369 |
370 def RunSmoothness(self, action_runner): | 370 def RunSmoothness(self, action_runner): |
371 for _ in xrange(6): | 371 for _ in xrange(6): |
372 self.ToggleDrawer(action_runner) | 372 self.ToggleDrawer(action_runner) |
373 | 373 |
374 def ToggleDrawer(self, action_runner): | 374 def ToggleDrawer(self, action_runner): |
(...skipping 17 matching lines...) Expand all Loading... |
392 'selector': '#menu-button' | 392 'selector': '#menu-button' |
393 })) | 393 })) |
394 action_runner.BeginInteraction('Wait', [tir_module.IS_SMOOTH]) | 394 action_runner.BeginInteraction('Wait', [tir_module.IS_SMOOTH]) |
395 action_runner.RunAction(WaitAction({ | 395 action_runner.RunAction(WaitAction({ |
396 'javascript': 'document.getElementById("nav-drawer").active' | 396 'javascript': 'document.getElementById("nav-drawer").active' |
397 })) | 397 })) |
398 action_runner.EndInteraction('Wait', [tir_module.IS_SMOOTH]) | 398 action_runner.EndInteraction('Wait', [tir_module.IS_SMOOTH]) |
399 | 399 |
400 | 400 |
401 def RunNavigateSteps(self, action_runner): | 401 def RunNavigateSteps(self, action_runner): |
402 action_runner.RunAction(NavigateAction()) | 402 action_runner.NavigateToPage(self) |
403 action_runner.RunAction(WaitAction({'seconds': 2})) | 403 action_runner.RunAction(WaitAction({'seconds': 2})) |
404 self.ToggleDrawer(action_runner) | 404 self.ToggleDrawer(action_runner) |
405 | 405 |
406 def RunSmoothness(self, action_runner): | 406 def RunSmoothness(self, action_runner): |
407 self.SlideDrawer(action_runner) | 407 self.SlideDrawer(action_runner) |
408 | 408 |
409 def SlideDrawer(self, action_runner): | 409 def SlideDrawer(self, action_runner): |
410 action_runner.RunAction(SwipeAction( | 410 action_runner.RunAction(SwipeAction( |
411 { | 411 { |
412 'left_start_percentage': 0.8, | 412 'left_start_percentage': 0.8, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 { | 469 { |
470 'element_function': ''' | 470 'element_function': ''' |
471 function(callback) { | 471 function(callback) { |
472 callback(document.getElementsByClassName("vk_arc")[0]); | 472 callback(document.getElementsByClassName("vk_arc")[0]); |
473 }''', | 473 }''', |
474 'wait_after': {'seconds': 2} | 474 'wait_after': {'seconds': 2} |
475 })) | 475 })) |
476 | 476 |
477 | 477 |
478 def RunNavigateSteps(self, action_runner): | 478 def RunNavigateSteps(self, action_runner): |
479 action_runner.RunAction(NavigateAction()) | 479 action_runner.NavigateToPage(self) |
480 action_runner.RunAction(WaitAction({'seconds': 3})) | 480 action_runner.RunAction(WaitAction({'seconds': 3})) |
481 self.ScrollKnowledgeCardToTop(action_runner) | 481 self.ScrollKnowledgeCardToTop(action_runner) |
482 | 482 |
483 def RunSmoothness(self, action_runner): | 483 def RunSmoothness(self, action_runner): |
484 self.ExpandKnowledgeCard(action_runner) | 484 self.ExpandKnowledgeCard(action_runner) |
485 | 485 |
486 | 486 |
487 class Page22(KeySilkCasesPage): | 487 class Page22(KeySilkCasesPage): |
488 | 488 |
489 def __init__(self, page_set): | 489 def __init__(self, page_set): |
490 super(Page22, self).__init__( | 490 super(Page22, self).__init__( |
491 url='http://plus.google.com/app/basic/stream', | 491 url='http://plus.google.com/app/basic/stream', |
492 page_set=page_set) | 492 page_set=page_set) |
493 | 493 |
494 self.disabled = 'Times out on Windows; crbug.com/338838' | 494 self.disabled = 'Times out on Windows; crbug.com/338838' |
495 self.credentials = 'google' | 495 self.credentials = 'google' |
496 | 496 |
497 def RunNavigateSteps(self, action_runner): | 497 def RunNavigateSteps(self, action_runner): |
498 action_runner.RunAction(NavigateAction()) | 498 action_runner.NavigateToPage(self) |
499 action_runner.RunAction(WaitAction( | 499 action_runner.RunAction(WaitAction( |
500 { | 500 { |
501 'javascript': 'document.getElementsByClassName("fHa").length > 0' | 501 'javascript': 'document.getElementsByClassName("fHa").length > 0' |
502 })) | 502 })) |
503 action_runner.RunAction(WaitAction( | 503 action_runner.RunAction(WaitAction( |
504 { | 504 { |
505 'seconds': 2 | 505 'seconds': 2 |
506 })) | 506 })) |
507 | 507 |
508 def RunSmoothness(self, action_runner): | 508 def RunSmoothness(self, action_runner): |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 """ | 545 """ |
546 Why: Google News: this iOS version is slower than accelerated scrolling | 546 Why: Google News: this iOS version is slower than accelerated scrolling |
547 """ | 547 """ |
548 | 548 |
549 def __init__(self, page_set): | 549 def __init__(self, page_set): |
550 super(Page24, self).__init__( | 550 super(Page24, self).__init__( |
551 url='http://mobile-news.sandbox.google.com/news/pt0?scroll', | 551 url='http://mobile-news.sandbox.google.com/news/pt0?scroll', |
552 page_set=page_set) | 552 page_set=page_set) |
553 | 553 |
554 def RunNavigateSteps(self, action_runner): | 554 def RunNavigateSteps(self, action_runner): |
555 action_runner.RunAction(NavigateAction()) | 555 action_runner.NavigateToPage(self) |
556 action_runner.RunAction(WaitAction( | 556 action_runner.RunAction(WaitAction( |
557 { | 557 { |
558 'javascript': 'document.getElementById(":h") != null' | 558 'javascript': 'document.getElementById(":h") != null' |
559 })) | 559 })) |
560 action_runner.RunAction(WaitAction( | 560 action_runner.RunAction(WaitAction( |
561 { | 561 { |
562 'seconds': 1 | 562 'seconds': 1 |
563 })) | 563 })) |
564 | 564 |
565 def RunSmoothness(self, action_runner): | 565 def RunSmoothness(self, action_runner): |
566 action_runner.RunAction(ScrollAction( | 566 action_runner.RunAction(ScrollAction( |
567 { | 567 { |
568 'scroll_distance_function': 'function() { return 2500; }', | 568 'scroll_distance_function': 'function() { return 2500; }', |
569 'scrollable_element_function': | 569 'scrollable_element_function': |
570 'function(callback) { callback(document.getElementById(":5")); }', | 570 'function(callback) { callback(document.getElementById(":5")); }', |
571 'scroll_requires_touch': True | 571 'scroll_requires_touch': True |
572 })) | 572 })) |
573 | 573 |
574 | 574 |
575 class Page25(KeySilkCasesPage): | 575 class Page25(KeySilkCasesPage): |
576 | 576 |
577 def __init__(self, page_set): | 577 def __init__(self, page_set): |
578 super(Page25, self).__init__( | 578 super(Page25, self).__init__( |
579 url='http://mobile-news.sandbox.google.com/news/pt0?swipe', | 579 url='http://mobile-news.sandbox.google.com/news/pt0?swipe', |
580 page_set=page_set) | 580 page_set=page_set) |
581 | 581 |
582 def RunNavigateSteps(self, action_runner): | 582 def RunNavigateSteps(self, action_runner): |
583 action_runner.RunAction(NavigateAction()) | 583 action_runner.NavigateToPage(self) |
584 action_runner.RunAction(WaitAction( | 584 action_runner.RunAction(WaitAction( |
585 { | 585 { |
586 'javascript': 'document.getElementById(":h") != null' | 586 'javascript': 'document.getElementById(":h") != null' |
587 })) | 587 })) |
588 action_runner.RunAction(WaitAction( | 588 action_runner.RunAction(WaitAction( |
589 { | 589 { |
590 'seconds': 1 | 590 'seconds': 1 |
591 })) | 591 })) |
592 | 592 |
593 def RunSmoothness(self, action_runner): | 593 def RunSmoothness(self, action_runner): |
(...skipping 14 matching lines...) Expand all Loading... |
608 class Page26(KeySilkCasesPage): | 608 class Page26(KeySilkCasesPage): |
609 | 609 |
610 """ Why: famo.us twitter demo """ | 610 """ Why: famo.us twitter demo """ |
611 | 611 |
612 def __init__(self, page_set): | 612 def __init__(self, page_set): |
613 super(Page26, self).__init__( | 613 super(Page26, self).__init__( |
614 url='http://s.codepen.io/befamous/fullpage/pFsqb?scroll', | 614 url='http://s.codepen.io/befamous/fullpage/pFsqb?scroll', |
615 page_set=page_set) | 615 page_set=page_set) |
616 | 616 |
617 def RunNavigateSteps(self, action_runner): | 617 def RunNavigateSteps(self, action_runner): |
618 action_runner.RunAction(NavigateAction()) | 618 action_runner.NavigateToPage(self) |
619 action_runner.RunAction(WaitAction( | 619 action_runner.RunAction(WaitAction( |
620 { | 620 { |
621 'javascript': 'document.getElementsByClassName("tweet").length > 0' | 621 'javascript': 'document.getElementsByClassName("tweet").length > 0' |
622 })) | 622 })) |
623 action_runner.RunAction(WaitAction( | 623 action_runner.RunAction(WaitAction( |
624 { | 624 { |
625 'seconds': 1 | 625 'seconds': 1 |
626 })) | 626 })) |
627 | 627 |
628 def RunSmoothness(self, action_runner): | 628 def RunSmoothness(self, action_runner): |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 self.AddPage(Page17(self)) | 661 self.AddPage(Page17(self)) |
662 self.AddPage(Page18(self)) | 662 self.AddPage(Page18(self)) |
663 self.AddPage(Page19(self)) | 663 self.AddPage(Page19(self)) |
664 self.AddPage(Page20(self)) | 664 self.AddPage(Page20(self)) |
665 self.AddPage(Page21(self)) | 665 self.AddPage(Page21(self)) |
666 self.AddPage(Page22(self)) | 666 self.AddPage(Page22(self)) |
667 self.AddPage(Page23(self)) | 667 self.AddPage(Page23(self)) |
668 self.AddPage(Page24(self)) | 668 self.AddPage(Page24(self)) |
669 self.AddPage(Page25(self)) | 669 self.AddPage(Page25(self)) |
670 self.AddPage(Page26(self)) | 670 self.AddPage(Page26(self)) |
OLD | NEW |