Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: tools/perf/page_sets/key_hit_test_cases.py

Issue 1066983002: Improve hit-testing telemetry test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from telemetry.page import page as page_module 5 from telemetry.page import page as page_module
6 from telemetry.page import page_set as page_set_module 6 from telemetry.page import page_set as page_set_module
7 7
8 from page_sets import polymer
8 9
9 class KeyHitTestCasesPage(page_module.Page): 10 class PaperCalculatorHitTest(polymer.PolymerPage):
10
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'
15
16 def RunNavigateSteps(self, action_runner):
17 super(KeyHitTestCasesPage, self).RunNavigateSteps(action_runner)
18 action_runner.Wait(2)
19
20 def RunPageInteractions(self, action_runner):
21 action_runner.Wait(2)
22 for _ in xrange(100):
23 self.TapButton(action_runner)
24
25
26 class PaperCalculatorHitTest(KeyHitTestCasesPage):
27 11
28 def __init__(self, page_set): 12 def __init__(self, page_set):
29 super(PaperCalculatorHitTest, self).__init__( 13 super(PaperCalculatorHitTest, self).__init__(
30 # Generated from https://github.com/zqureshi/paper-calculator 14 # Generated from https://github.com/zqureshi/paper-calculator
31 # vulcanize --inline --strip paper-calculator/demo.html 15 # vulcanize --inline --strip paper-calculator/demo.html
32 url='file://key_hit_test_cases/paper-calculator-no-rendering.html', 16 url='file://key_hit_test_cases/paper-calculator-no-rendering.html',
33 page_set=page_set) 17 page_set=page_set, run_no_page_interactions=False)
34 18
35 def TapButton(self, action_runner): 19 self.user_agent_type = 'mobile'
36 interaction = action_runner.BeginInteraction( 20
37 'Action_TapAction') 21 def PerformPageInteractions(self, action_runner):
38 action_runner.TapElement(element_function=''' 22 # pay cost of selecting tap target only once
39 document.querySelector( 23 action_runner.ExecuteJavaScript('''
24 window.__tapTarget = document.querySelector(
40 'body /deep/ #outerPanels' 25 'body /deep/ #outerPanels'
41 ).querySelector( 26 ).querySelector(
42 '#standard' 27 '#standard'
43 ).shadowRoot.querySelector( 28 ).shadowRoot.querySelector(
44 'paper-calculator-key[label="5"]' 29 'paper-calculator-key[label="5"]'
45 )''') 30 )''')
31 action_runner.WaitForJavaScriptCondition(
32 'window.__tapTarget != null')
33
34 for _ in xrange(100):
35 self.TapButton(action_runner)
36
37 def TapButton(self, action_runner):
38 interaction = action_runner.BeginInteraction(
39 'Action_TapAction')
nednguyen 2015/04/08 16:27:26 Why do you create an interaction record here?
majidvp 2015/04/08 18:32:30 It was there and I left it as is. Should I remove
nednguyen 2015/04/08 18:36:47 Thanks, I didn't notice that it was here before.
40 action_runner.TapElement(element_function='''window.__tapTarget''')
46 interaction.End() 41 interaction.End()
47 42
48 43
49 class KeyHitTestCasesPageSet(page_set_module.PageSet): 44 class KeyHitTestCasesPageSet(page_set_module.PageSet):
50 45
51 def __init__(self): 46 def __init__(self):
52 super(KeyHitTestCasesPageSet, self).__init__( 47 super(KeyHitTestCasesPageSet, self).__init__(
53 user_agent_type='mobile') 48 user_agent_type='mobile')
54 49
55 self.AddUserStory(PaperCalculatorHitTest(self)) 50 self.AddUserStory(PaperCalculatorHitTest(self))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698