| 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 class PolymerPage(page_module.Page): | 9 class PolymerPage(page_module.Page): |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 def __init__(self, page_set): | 30 def __init__(self, page_set): |
| 31 super(PolymerCalculatorPage, self).__init__( | 31 super(PolymerCalculatorPage, self).__init__( |
| 32 url='http://localhost:8000/components/paper-calculator/demo.html', | 32 url='http://localhost:8000/components/paper-calculator/demo.html', |
| 33 page_set=page_set) | 33 page_set=page_set) |
| 34 | 34 |
| 35 def RunSmoothness(self, action_runner): | 35 def RunSmoothness(self, action_runner): |
| 36 self.TapButton(action_runner) | 36 self.TapButton(action_runner) |
| 37 self.SlidePanel(action_runner) | 37 self.SlidePanel(action_runner) |
| 38 | 38 |
| 39 def TapButton(self, action_runner): | 39 def TapButton(self, action_runner): |
| 40 action_runner.RunAction(TapAction( | 40 interaction = action_runner.BeginInteraction( |
| 41 { | 41 'Action_TapAction', is_smooth=True) |
| 42 'element_function': ''' | 42 action_runner.TapElement(element_function=''' |
| 43 function(callback) { | 43 document.querySelector( |
| 44 callback( | 44 'body /deep/ #outerPanels' |
| 45 document.querySelector( | 45 ).querySelector( |
| 46 'body /deep/ #outerPanels' | 46 '#standard' |
| 47 ).querySelector( | 47 ).shadowRoot.querySelector( |
| 48 '#standard' | 48 'paper-calculator-key[label="5"]' |
| 49 ).shadowRoot.querySelector( | 49 )''') |
| 50 'paper-calculator-key[label="5"]' | 50 action_runner.Wait(2) |
| 51 ) | 51 interaction.End() |
| 52 ); | |
| 53 }''', | |
| 54 'wait_after': { 'seconds': 2 } | |
| 55 })) | |
| 56 | 52 |
| 57 def SlidePanel(self, action_runner): | 53 def SlidePanel(self, action_runner): |
| 58 action_runner.RunAction(SwipeAction( | 54 action_runner.RunAction(SwipeAction( |
| 59 { | 55 { |
| 60 'left_start_percentage': 0.1, | 56 'left_start_percentage': 0.1, |
| 61 'distance': 300, | 57 'distance': 300, |
| 62 'direction': 'left', | 58 'direction': 'left', |
| 63 'wait_after': { | 59 'wait_after': { |
| 64 'javascript': ''' | 60 'javascript': ''' |
| 65 var outer = document.querySelector("body /deep/ #outerPanels"); | 61 var outer = document.querySelector("body /deep/ #outerPanels"); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 103 |
| 108 class PolymerPageSet(page_set_module.PageSet): | 104 class PolymerPageSet(page_set_module.PageSet): |
| 109 | 105 |
| 110 def __init__(self): | 106 def __init__(self): |
| 111 super(PolymerPageSet, self).__init__( | 107 super(PolymerPageSet, self).__init__( |
| 112 user_agent_type='mobile', | 108 user_agent_type='mobile', |
| 113 archive_data_file='data/polymer.json') | 109 archive_data_file='data/polymer.json') |
| 114 | 110 |
| 115 self.AddPage(PolymerCalculatorPage(self)) | 111 self.AddPage(PolymerCalculatorPage(self)) |
| 116 self.AddPage(PolymerShadowPage(self)) | 112 self.AddPage(PolymerShadowPage(self)) |
| OLD | NEW |