Unify Help/Feedback/Credits menus.
[chromium-blink-merge.git] / tools / perf / page_sets / key_hit_test_cases.py
blobe8a16690d92eaf9455ce108c0405b601eda85e08
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.
5 from telemetry.page import page_set as page_set_module
7 from page_sets import polymer
9 class PaperCalculatorHitTest(polymer.PolymerPage):
11 def __init__(self, page_set):
12 super(PaperCalculatorHitTest, self).__init__(
13 # Generated from https://github.com/zqureshi/paper-calculator
14 # vulcanize --inline --strip paper-calculator/demo.html
15 url='file://key_hit_test_cases/paper-calculator-no-rendering.html',
16 page_set=page_set, run_no_page_interactions=False)
19 def PerformPageInteractions(self, action_runner):
20 # pay cost of selecting tap target only once
21 action_runner.ExecuteJavaScript('''
22 window.__tapTarget = document.querySelector(
23 'body /deep/ #outerPanels'
24 ).querySelector(
25 '#standard'
26 ).shadowRoot.querySelector(
27 'paper-calculator-key[label="5"]'
28 )''')
29 action_runner.WaitForJavaScriptCondition(
30 'window.__tapTarget != null')
32 for _ in xrange(100):
33 self.TapButton(action_runner)
35 def TapButton(self, action_runner):
36 with action_runner.CreateInteraction('Action_TapAction'):
37 action_runner.TapElement(element_function='''window.__tapTarget''')
40 class KeyHitTestCasesPageSet(page_set_module.PageSet):
42 def __init__(self):
43 super(KeyHitTestCasesPageSet, self).__init__()
45 self.AddUserStory(PaperCalculatorHitTest(self))