Chromium Code Reviews| 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. | |
|
nednguyen
2014/12/10 22:33:49
nit: add a blank line here
Zeeshan Qureshi
2014/12/12 01:05:30
Done.
| |
| 4 from telemetry.page import page as page_module | |
| 5 from telemetry.page import page_set as page_set_module | |
| 6 | |
| 7 | |
| 8 class KeyHitTestCasesPage(page_module.Page): | |
| 9 | |
| 10 def __init__(self, url, page_set): | |
| 11 super(KeyHitTestCasesPage, self).__init__( | |
| 12 url=url, page_set=page_set, credentials_path = 'data/credentials.json') | |
| 13 self.user_agent_type = 'mobile' | |
| 14 | |
| 15 def RunNavigateSteps(self, action_runner): | |
| 16 action_runner.NavigateToPage(self) | |
| 17 action_runner.Wait(2) | |
| 18 | |
| 19 def RunSmoothness(self, action_runner): | |
| 20 action_runner.Wait(2) | |
| 21 for _ in xrange(100): | |
| 22 self.TapButton(action_runner) | |
| 23 | |
| 24 | |
| 25 class PaperCalculatorHitTest(KeyHitTestCasesPage): | |
|
nednguyen
2014/12/10 22:33:50
You only need this if you plan to create other pag
Zeeshan Qureshi
2014/12/12 01:05:30
I believe that's the plan, as we identify more hit
| |
| 26 | |
| 27 def __init__(self, page_set): | |
| 28 super(PaperCalculatorHitTest, self).__init__( | |
| 29 # Generated from https://github.com/zqureshi/paper-calculator | |
| 30 # vulcanize --inline --strip paper-calculator/demo.html | |
| 31 url='file://key_hit_test_cases/paper-calculator-no-rendering.html', | |
| 32 page_set=page_set) | |
| 33 | |
| 34 def TapButton(self, action_runner): | |
| 35 interaction = action_runner.BeginInteraction( | |
| 36 'Action_TapAction', is_smooth=True) | |
| 37 action_runner.TapElement(element_function=''' | |
| 38 document.querySelector( | |
| 39 'body /deep/ #outerPanels' | |
| 40 ).querySelector( | |
| 41 '#standard' | |
| 42 ).shadowRoot.querySelector( | |
| 43 'paper-calculator-key[label="5"]' | |
| 44 )''') | |
| 45 interaction.End() | |
| 46 | |
| 47 | |
| 48 class KeyHitTestCasesPageSet(page_set_module.PageSet): | |
| 49 | |
| 50 def __init__(self): | |
| 51 super(KeyHitTestCasesPageSet, self).__init__( | |
| 52 user_agent_type='mobile') | |
| 53 | |
| 54 self.AddPage(PaperCalculatorHitTest(self)) | |
| OLD | NEW |