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

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

Issue 826113003: [Telemetry] Rename RunSmoothness to RunPageInteractions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « tools/perf/page_sets/key_hit_test_cases.py ('k') | tools/perf/page_sets/key_search_mobile.py » ('j') | 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 from telemetry.page import page as page_module 4 from telemetry.page import page as page_module
5 from telemetry.page import page_set as page_set_module 5 from telemetry.page import page_set as page_set_module
6 6
7 from page_sets import key_mobile_sites_pages 7 from page_sets import key_mobile_sites_pages
8 8
9 9
10 def _IssueMarkerAndScroll(action_runner): 10 def _IssueMarkerAndScroll(action_runner):
11 interaction = action_runner.BeginGestureInteraction( 11 interaction = action_runner.BeginGestureInteraction(
12 'ScrollAction', is_smooth=True) 12 'ScrollAction', is_smooth=True)
13 action_runner.ScrollPage() 13 action_runner.ScrollPage()
14 interaction.End() 14 interaction.End()
15 15
16 16
17 def _CreatePageClassWithSmoothInteractions(page_cls): 17 def _CreatePageClassWithSmoothInteractions(page_cls):
18 class DerivedSmoothPage(page_cls): # pylint: disable=W0232 18 class DerivedSmoothPage(page_cls): # pylint: disable=W0232
19 19
20 def RunSmoothness(self, action_runner): 20 def RunPageInteractions(self, action_runner):
21 _IssueMarkerAndScroll(action_runner) 21 _IssueMarkerAndScroll(action_runner)
22 return DerivedSmoothPage 22 return DerivedSmoothPage
23 23
24 24
25 class KeyMobileSitesSmoothPage(page_module.Page): 25 class KeyMobileSitesSmoothPage(page_module.Page):
26 26
27 def __init__(self, url, page_set, name='', labels=None): 27 def __init__(self, url, page_set, name='', labels=None):
28 super(KeyMobileSitesSmoothPage, self).__init__( 28 super(KeyMobileSitesSmoothPage, self).__init__(
29 url=url, page_set=page_set, name=name, 29 url=url, page_set=page_set, name=name,
30 credentials_path='data/credentials.json', labels=labels) 30 credentials_path='data/credentials.json', labels=labels)
31 self.user_agent_type = 'mobile' 31 self.user_agent_type = 'mobile'
32 self.archive_data_file = 'data/key_mobile_sites.json' 32 self.archive_data_file = 'data/key_mobile_sites.json'
33 33
34 def RunSmoothness(self, action_runner): 34 def RunPageInteractions(self, action_runner):
35 _IssueMarkerAndScroll(action_runner) 35 _IssueMarkerAndScroll(action_runner)
36 36
37 37
38 class GmailSmoothPage(key_mobile_sites_pages.GmailPage): 38 class GmailSmoothPage(key_mobile_sites_pages.GmailPage):
39 39
40 def RunSmoothness(self, action_runner): 40 def RunPageInteractions(self, action_runner):
41 interaction = action_runner.BeginGestureInteraction( 41 interaction = action_runner.BeginGestureInteraction(
42 'ScrollAction', is_smooth=True) 42 'ScrollAction', is_smooth=True)
43 action_runner.ScrollElement(element_function=( 43 action_runner.ScrollElement(element_function=(
44 'document.getElementById("views").childNodes[1].firstChild')) 44 'document.getElementById("views").childNodes[1].firstChild'))
45 interaction.End() 45 interaction.End()
46 interaction = action_runner.BeginGestureInteraction( 46 interaction = action_runner.BeginGestureInteraction(
47 'ScrollAction', is_smooth=True) 47 'ScrollAction', is_smooth=True)
48 action_runner.ScrollElement(element_function=( 48 action_runner.ScrollElement(element_function=(
49 'document.getElementById("views").childNodes[1].firstChild')) 49 'document.getElementById("views").childNodes[1].firstChild'))
50 interaction.End() 50 interaction.End()
51 51
52 52
53 class GroupClonedSmoothPage(key_mobile_sites_pages.GroupClonedPage): 53 class GroupClonedSmoothPage(key_mobile_sites_pages.GroupClonedPage):
54 54
55 def RunSmoothness(self, action_runner): 55 def RunPageInteractions(self, action_runner):
56 interaction = action_runner.BeginGestureInteraction( 56 interaction = action_runner.BeginGestureInteraction(
57 'ScrollAction', is_smooth=True) 57 'ScrollAction', is_smooth=True)
58 action_runner.ScrollPage( 58 action_runner.ScrollPage(
59 distance_expr=''' 59 distance_expr='''
60 Math.max(0, 1250 + document.getElementById("element-19") 60 Math.max(0, 1250 + document.getElementById("element-19")
61 .contentDocument 61 .contentDocument
62 .getElementById("element-22") 62 .getElementById("element-22")
63 .getBoundingClientRect().top);''', 63 .getBoundingClientRect().top);''',
64 use_touch=True) 64 use_touch=True)
65 interaction.End() 65 interaction.End()
66 66
67 67
68 class GroupClonedListImagesPage( 68 class GroupClonedListImagesPage(
69 key_mobile_sites_pages.GroupClonedListImagesPage): 69 key_mobile_sites_pages.GroupClonedListImagesPage):
70 70
71 def RunSmoothness(self, action_runner): 71 def RunPageInteractions(self, action_runner):
72 interaction = action_runner.BeginGestureInteraction( 72 interaction = action_runner.BeginGestureInteraction(
73 'ScrollAction', is_smooth=True) 73 'ScrollAction', is_smooth=True)
74 action_runner.ScrollPage( 74 action_runner.ScrollPage(
75 distance_expr=''' 75 distance_expr='''
76 Math.max(0, 1250 + 76 Math.max(0, 1250 +
77 document.getElementById("element-5") 77 document.getElementById("element-5")
78 .getBoundingClientRect().top);''', 78 .getBoundingClientRect().top);''',
79 use_touch=True) 79 use_touch=True)
80 interaction.End() 80 interaction.End()
81 81
82 class GoogleNewsMobile2SmoothPage( 82 class GoogleNewsMobile2SmoothPage(
83 key_mobile_sites_pages.GoogleNewsMobile2Page): 83 key_mobile_sites_pages.GoogleNewsMobile2Page):
84 84
85 def RunSmoothness(self, action_runner): 85 def RunPageInteractions(self, action_runner):
86 interaction = action_runner.BeginGestureInteraction( 86 interaction = action_runner.BeginGestureInteraction(
87 'ScrollAction', is_smooth=True) 87 'ScrollAction', is_smooth=True)
88 action_runner.ScrollElement( 88 action_runner.ScrollElement(
89 element_function='document.getElementById(":5")', 89 element_function='document.getElementById(":5")',
90 distance_expr=''' 90 distance_expr='''
91 Math.max(0, 2500 + 91 Math.max(0, 2500 +
92 document.getElementById(':h').getBoundingClientRect().top)''', 92 document.getElementById(':h').getBoundingClientRect().top)''',
93 use_touch=True) 93 use_touch=True)
94 interaction.End() 94 interaction.End()
95 95
96 96
97 class AmazonNicolasCageSmoothPage( 97 class AmazonNicolasCageSmoothPage(
98 key_mobile_sites_pages.AmazonNicolasCagePage): 98 key_mobile_sites_pages.AmazonNicolasCagePage):
99 99
100 def RunSmoothness(self, action_runner): 100 def RunPageInteractions(self, action_runner):
101 interaction = action_runner.BeginGestureInteraction( 101 interaction = action_runner.BeginGestureInteraction(
102 'ScrollAction', is_smooth=True) 102 'ScrollAction', is_smooth=True)
103 action_runner.ScrollElement( 103 action_runner.ScrollElement(
104 selector='#search', 104 selector='#search',
105 distance_expr='document.body.scrollHeight - window.innerHeight') 105 distance_expr='document.body.scrollHeight - window.innerHeight')
106 interaction.End() 106 interaction.End()
107 107
108 108
109 class KeyMobileSitesSmoothPageSet(page_set_module.PageSet): 109 class KeyMobileSitesSmoothPageSet(page_set_module.PageSet):
110 110
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&' 252 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&'
253 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'), 253 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'),
254 # Why: Top search engine 254 # Why: Top search engine
255 'http://www.bing.com/search?q=sloths', 255 'http://www.bing.com/search?q=sloths',
256 # Why: Good example of poor initial scrolling 256 # Why: Good example of poor initial scrolling
257 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans' 257 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans'
258 ] 258 ]
259 259
260 for url in urls_list: 260 for url in urls_list:
261 self.AddUserStory(KeyMobileSitesSmoothPage(url, self)) 261 self.AddUserStory(KeyMobileSitesSmoothPage(url, self))
OLDNEW
« no previous file with comments | « tools/perf/page_sets/key_hit_test_cases.py ('k') | tools/perf/page_sets/key_search_mobile.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698