Chromium Code Reviews| Index: tools/perf/page_sets/key_tap_cases.py |
| diff --git a/tools/perf/page_sets/key_tap_cases.py b/tools/perf/page_sets/key_tap_cases.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..85fb77d22db5282f7e562cd4b9de357971bd1f8e |
| --- /dev/null |
| +++ b/tools/perf/page_sets/key_tap_cases.py |
| @@ -0,0 +1,63 @@ |
| +# Copyright 2014 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| +from telemetry.page import page as page_module |
| +from telemetry.page import page_set as page_set_module |
| + |
| + |
| +class KeyTapCasesPage(page_module.Page): |
| + |
| + def __init__(self, url, page_set): |
| + super(KeyTapCasesPage, self).__init__( |
| + url=url, page_set=page_set, credentials_path = 'data/credentials.json') |
| + self.user_agent_type = 'mobile' |
| + self.archive_data_file = 'data/key_tap_cases.json' |
| + |
| + def RunNavigateSteps(self, action_runner): |
| + action_runner.NavigateToPage(self) |
| + action_runner.Wait(2) |
| + |
| + def RunSmoothness(self, action_runner): |
| + interaction = action_runner.BeginGestureInteraction( |
| + 'ScrollAction', is_smooth=True) |
| + action_runner.ScrollPage() |
| + interaction.End() |
| + |
| + |
| +class PaperCalculatorHitTest(KeyTapCasesPage): |
| + |
| + def __init__(self, page_set): |
| + super(PaperCalculatorHitTest, self).__init__( |
| + #url=('http://www.polymer-project.org/components/paper-calculator/' |
| + url=('http://zqureshi.github.io/paper-calculator/paper-calculator/' |
|
Rick Byers
2014/12/10 02:56:43
rather than put this up on github and take a wpr o
Zeeshan Qureshi
2014/12/10 20:34:26
Done, and the file's not too big after all.
|
| + 'demo.html'), |
| + page_set=page_set) |
| + |
| + def RunSmoothness(self, action_runner): |
|
Rick Byers
2014/12/10 02:56:43
If you're going to have a key_tap_caess pageset, t
Zeeshan Qureshi
2014/12/10 20:34:25
Since the tap action for each page will be slightl
|
| + action_runner.Wait(2) |
| + for _ in xrange(100): |
| + self.TapButton(action_runner) |
| + |
| + def TapButton(self, action_runner): |
| + interaction = action_runner.BeginInteraction( |
| + 'Action_TapAction', is_smooth=True) |
| + action_runner.TapElement(element_function=''' |
| + document.querySelector( |
| + 'body /deep/ #outerPanels' |
| + ).querySelector( |
| + '#standard' |
| + ).shadowRoot.querySelector( |
| + 'paper-calculator-key[label="5"]' |
| + )''') |
| + interaction.End() |
| + |
| + |
| +class KeyTapCasesPageSet(page_set_module.PageSet): |
| + |
| + def __init__(self): |
| + super(KeyTapCasesPageSet, self).__init__( |
| + user_agent_type='mobile', |
| + archive_data_file='data/key_tap_cases.json', |
| + bucket=page_set_module.PARTNER_BUCKET) |
| + |
| + self.AddPage(PaperCalculatorHitTest(self)) |