Re-land: C++ readability review
[chromium-blink-merge.git] / tools / perf / page_sets / key_hit_test_cases.py
blobf573d107582cb3cc3e55a99ac435efd5d6cf7790
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 as page_module
6 from telemetry.page import page_set as page_set_module
9 class KeyHitTestCasesPage(page_module.Page):
11 def __init__(self, url, page_set):
12 super(KeyHitTestCasesPage, self).__init__(
13 url=url, page_set=page_set, credentials_path = 'data/credentials.json')
14 self.user_agent_type = 'mobile'
16 def RunNavigateSteps(self, action_runner):
17 super(KeyHitTestCasesPage, self).RunNavigateSteps(action_runner)
18 action_runner.Wait(2)
20 def RunPageInteractions(self, action_runner):
21 action_runner.Wait(2)
22 for _ in xrange(100):
23 self.TapButton(action_runner)
26 class PaperCalculatorHitTest(KeyHitTestCasesPage):
28 def __init__(self, page_set):
29 super(PaperCalculatorHitTest, self).__init__(
30 # Generated from https://github.com/zqureshi/paper-calculator
31 # vulcanize --inline --strip paper-calculator/demo.html
32 url='file://key_hit_test_cases/paper-calculator-no-rendering.html',
33 page_set=page_set)
35 def TapButton(self, action_runner):
36 interaction = action_runner.BeginInteraction(
37 'Action_TapAction')
38 action_runner.TapElement(element_function='''
39 document.querySelector(
40 'body /deep/ #outerPanels'
41 ).querySelector(
42 '#standard'
43 ).shadowRoot.querySelector(
44 'paper-calculator-key[label="5"]'
45 )''')
46 interaction.End()
49 class KeyHitTestCasesPageSet(page_set_module.PageSet):
51 def __init__(self):
52 super(KeyHitTestCasesPageSet, self).__init__(
53 user_agent_type='mobile')
55 self.AddUserStory(PaperCalculatorHitTest(self))