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 | 8 |
9 | 9 |
10 class KeySilkCasesPage(page_module.Page): | 10 class KeySilkCasesPage(page_module.Page): |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
557 'document.getElementsByClassName("tweet").length > 0') | 557 'document.getElementsByClassName("tweet").length > 0') |
558 action_runner.Wait(1) | 558 action_runner.Wait(1) |
559 | 559 |
560 def RunSmoothness(self, action_runner): | 560 def RunSmoothness(self, action_runner): |
561 interaction = action_runner.BeginGestureInteraction( | 561 interaction = action_runner.BeginGestureInteraction( |
562 'ScrollAction', is_smooth=True) | 562 'ScrollAction', is_smooth=True) |
563 action_runner.ScrollPage(distance=5000) | 563 action_runner.ScrollPage(distance=5000) |
564 interaction.End() | 564 interaction.End() |
565 | 565 |
566 | 566 |
567 class SVGIconRaster(KeySilkCasesPage): | |
568 | |
569 """ Why: Mutating SVG icons; these paint storm and paint slowly. """ | |
570 | |
571 def __init__(self, page_set): | |
572 super(SVGIconRaster, self).__init__( | |
573 url='http://wiltzius.github.io/shape-shifter/', | |
Sami
2014/07/08 11:18:37
This is from a different patch, right? It's not in
| |
574 page_set=page_set) | |
575 | |
576 def RunNavigateSteps(self, action_runner): | |
577 action_runner.NavigateToPage(self) | |
578 action_runner.WaitForJavaScriptCondition( | |
579 'loaded = true') | |
580 action_runner.Wait(1) | |
581 | |
582 def RunSmoothness(self, action_runner): | |
583 for i in xrange(9): | |
584 button_func = ('document.getElementById("demo").$.' | |
585 'buttons.children[%d]') % i | |
586 interaction = action_runner.BeginInteraction( | |
587 'Action_TapAction', is_smooth=True) | |
588 action_runner.TapElement(element_function=button_func) | |
589 action_runner.Wait(1) | |
590 interaction.End() | |
591 | |
592 | |
593 class UpdateHistoryState(KeySilkCasesPage): | |
594 | |
595 """ Why: Modern apps often update history state, which currently is janky.""" | |
596 | |
597 def __init__(self, page_set): | |
598 super(UpdateHistoryState, self).__init__( | |
599 url='http://wiltzius.github.io/janky-history-update/index.html', | |
600 page_set=page_set) | |
601 | |
602 def RunNavigateSteps(self, action_runner): | |
603 action_runner.NavigateToPage(self) | |
604 action_runner.ExecuteJavaScript(''' | |
605 window.requestAnimationFrame(function() { | |
606 window.__history_state_loaded = true; | |
607 }); | |
608 ''') | |
609 action_runner.WaitForJavaScriptCondition( | |
610 'window.__history_state_loaded == true;') | |
611 | |
612 def RunSmoothness(self, action_runner): | |
613 interaction = action_runner.BeginInteraction('animation_interaction', | |
614 is_smooth=True) | |
615 action_runner.Wait(5) # JS runs the animation continuously on the page | |
616 interaction.End() | |
617 | |
618 | |
567 class KeySilkCasesPageSet(page_set_module.PageSet): | 619 class KeySilkCasesPageSet(page_set_module.PageSet): |
568 | 620 |
569 """ Pages hand-picked for project Silk. """ | 621 """ Pages hand-picked for project Silk. """ |
570 | 622 |
571 def __init__(self): | 623 def __init__(self): |
572 super(KeySilkCasesPageSet, self).__init__( | 624 super(KeySilkCasesPageSet, self).__init__( |
573 credentials_path='data/credentials.json', | 625 credentials_path='data/credentials.json', |
574 user_agent_type='mobile', | 626 user_agent_type='mobile', |
575 archive_data_file='data/key_silk_cases.json', | 627 archive_data_file='data/key_silk_cases.json', |
576 bucket=page_set_module.PARTNER_BUCKET) | 628 bucket=page_set_module.PARTNER_BUCKET) |
(...skipping 17 matching lines...) Expand all Loading... | |
594 self.AddPage(Page17(self)) | 646 self.AddPage(Page17(self)) |
595 self.AddPage(Page18(self)) | 647 self.AddPage(Page18(self)) |
596 self.AddPage(Page19(self)) | 648 self.AddPage(Page19(self)) |
597 self.AddPage(Page20(self)) | 649 self.AddPage(Page20(self)) |
598 self.AddPage(Page21(self)) | 650 self.AddPage(Page21(self)) |
599 self.AddPage(Page22(self)) | 651 self.AddPage(Page22(self)) |
600 self.AddPage(Page23(self)) | 652 self.AddPage(Page23(self)) |
601 self.AddPage(Page24(self)) | 653 self.AddPage(Page24(self)) |
602 self.AddPage(Page25(self)) | 654 self.AddPage(Page25(self)) |
603 self.AddPage(Page26(self)) | 655 self.AddPage(Page26(self)) |
656 self.AddPage(SVGIconRaster(self)) | |
657 self.AddPage(UpdateHistoryState(self)) | |
658 | |
OLD | NEW |