OLD | NEW |
---|---|
(Empty) | |
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 | |
3 # found in the LICENSE file. | |
4 from telemetry.page import page as page_module | |
5 from telemetry.page import page_set as page_set_module | |
6 | |
7 | |
8 class KeyTapCasesPage(page_module.Page): | |
9 | |
10 def __init__(self, url, page_set): | |
11 super(KeyTapCasesPage, self).__init__( | |
12 url=url, page_set=page_set, credentials_path = 'data/credentials.json') | |
13 self.user_agent_type = 'mobile' | |
14 self.archive_data_file = 'data/key_tap_cases.json' | |
15 | |
16 def RunNavigateSteps(self, action_runner): | |
17 action_runner.NavigateToPage(self) | |
18 action_runner.Wait(2) | |
19 | |
20 def RunSmoothness(self, action_runner): | |
21 interaction = action_runner.BeginGestureInteraction( | |
22 'ScrollAction', is_smooth=True) | |
23 action_runner.ScrollPage() | |
24 interaction.End() | |
25 | |
26 | |
27 class PaperCalculatorHitTest(KeyTapCasesPage): | |
28 | |
29 def __init__(self, page_set): | |
30 super(PaperCalculatorHitTest, self).__init__( | |
31 #url=('http://www.polymer-project.org/components/paper-calculator/' | |
32 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.
| |
33 'demo.html'), | |
34 page_set=page_set) | |
35 | |
36 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
| |
37 action_runner.Wait(2) | |
38 for _ in xrange(100): | |
39 self.TapButton(action_runner) | |
40 | |
41 def TapButton(self, action_runner): | |
42 interaction = action_runner.BeginInteraction( | |
43 'Action_TapAction', is_smooth=True) | |
44 action_runner.TapElement(element_function=''' | |
45 document.querySelector( | |
46 'body /deep/ #outerPanels' | |
47 ).querySelector( | |
48 '#standard' | |
49 ).shadowRoot.querySelector( | |
50 'paper-calculator-key[label="5"]' | |
51 )''') | |
52 interaction.End() | |
53 | |
54 | |
55 class KeyTapCasesPageSet(page_set_module.PageSet): | |
56 | |
57 def __init__(self): | |
58 super(KeyTapCasesPageSet, self).__init__( | |
59 user_agent_type='mobile', | |
60 archive_data_file='data/key_tap_cases.json', | |
61 bucket=page_set_module.PARTNER_BUCKET) | |
62 | |
63 self.AddPage(PaperCalculatorHitTest(self)) | |
OLD | NEW |