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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 def RunSmoothness(self, action_runner): | 582 def RunSmoothness(self, action_runner): |
583 for i in xrange(9): | 583 for i in xrange(9): |
584 button_func = ('document.getElementById("demo").$.' | 584 button_func = ('document.getElementById("demo").$.' |
585 'buttons.children[%d]') % i | 585 'buttons.children[%d]') % i |
586 interaction = action_runner.BeginInteraction( | 586 interaction = action_runner.BeginInteraction( |
587 'Action_TapAction', is_smooth=True) | 587 'Action_TapAction', is_smooth=True) |
588 action_runner.TapElement(element_function=button_func) | 588 action_runner.TapElement(element_function=button_func) |
589 action_runner.Wait(1) | 589 action_runner.Wait(1) |
590 interaction.End() | 590 interaction.End() |
591 | 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='file://key_silk_cases/pushState.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 |
592 class KeySilkCasesPageSet(page_set_module.PageSet): | 619 class KeySilkCasesPageSet(page_set_module.PageSet): |
593 | 620 |
594 """ Pages hand-picked for project Silk. """ | 621 """ Pages hand-picked for project Silk. """ |
595 | 622 |
596 def __init__(self): | 623 def __init__(self): |
597 super(KeySilkCasesPageSet, self).__init__( | 624 super(KeySilkCasesPageSet, self).__init__( |
598 credentials_path='data/credentials.json', | 625 credentials_path='data/credentials.json', |
599 user_agent_type='mobile', | 626 user_agent_type='mobile', |
600 archive_data_file='data/key_silk_cases.json', | 627 archive_data_file='data/key_silk_cases.json', |
601 bucket=page_set_module.PARTNER_BUCKET) | 628 bucket=page_set_module.PARTNER_BUCKET) |
(...skipping 18 matching lines...) Expand all Loading... |
620 self.AddPage(Page18(self)) | 647 self.AddPage(Page18(self)) |
621 self.AddPage(Page19(self)) | 648 self.AddPage(Page19(self)) |
622 self.AddPage(Page20(self)) | 649 self.AddPage(Page20(self)) |
623 self.AddPage(Page21(self)) | 650 self.AddPage(Page21(self)) |
624 self.AddPage(Page22(self)) | 651 self.AddPage(Page22(self)) |
625 self.AddPage(Page23(self)) | 652 self.AddPage(Page23(self)) |
626 self.AddPage(Page24(self)) | 653 self.AddPage(Page24(self)) |
627 self.AddPage(Page25(self)) | 654 self.AddPage(Page25(self)) |
628 self.AddPage(Page26(self)) | 655 self.AddPage(Page26(self)) |
629 self.AddPage(SVGIconRaster(self)) | 656 self.AddPage(SVGIconRaster(self)) |
| 657 self.AddPage(UpdateHistoryState(self)) |
OLD | NEW |