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

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

Issue 1018213002: Remove GoogleMapsPage and GmailMouseScrollPage from top_25_smooth. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/top_25_smooth.py ('k') | 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 from telemetry.page import page as page_module 4 from telemetry.page import page as page_module
5 5
6 6
7 class TopPages(page_module.Page): 7 class TopPages(page_module.Page):
8 8
9 def __init__(self, url, page_set, name='', credentials=None): 9 def __init__(self, url, page_set, name='', credentials=None):
10 super(TopPages, self).__init__( 10 super(TopPages, self).__init__(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 def RunNavigateSteps(self, action_runner): 52 def RunNavigateSteps(self, action_runner):
53 super(GmailPage, self).RunNavigateSteps(action_runner) 53 super(GmailPage, self).RunNavigateSteps(action_runner)
54 action_runner.WaitForJavaScriptCondition( 54 action_runner.WaitForJavaScriptCondition(
55 'window.gmonkey !== undefined &&' 55 'window.gmonkey !== undefined &&'
56 'document.getElementById("gb") !== null') 56 'document.getElementById("gb") !== null')
57 # This check is needed for gmonkey to load completely. 57 # This check is needed for gmonkey to load completely.
58 action_runner.WaitForJavaScriptCondition( 58 action_runner.WaitForJavaScriptCondition(
59 'document.readyState == "complete"') 59 'document.readyState == "complete"')
60 60
61 61
62 class GmailMouseScrollPage(GmailPage):
63
64 """ Why: productivity, top google properties """
65
66 def RunPageInteractions(self, action_runner):
67 action_runner.ExecuteJavaScript('''
68 gmonkey.load('2.0', function(api) {
69 window.__scrollableElementForTelemetry = api.getScrollableElement();
70 });''')
71 action_runner.WaitForJavaScriptCondition(
72 'window.__scrollableElementForTelemetry != null')
73 scrollbar_x, start_y, end_y = self._CalculateScrollBarRatios(action_runner)
74
75 interaction = action_runner.BeginGestureInteraction(
76 'DragAction')
77 action_runner.DragPage(left_start_ratio=scrollbar_x,
78 top_start_ratio=start_y, left_end_ratio=scrollbar_x,
79 top_end_ratio=end_y, speed_in_pixels_per_second=100,
80 element_function='window.__scrollableElementForTelemetry')
81 interaction.End()
82
83 def _CalculateScrollBarRatios(self, action_runner):
84 viewport_height = float(action_runner.EvaluateJavaScript(
85 'window.__scrollableElementForTelemetry.clientHeight'))
86 content_height = float(action_runner.EvaluateJavaScript(
87 'window.__scrollableElementForTelemetry.scrollHeight'))
88 viewport_width = float(action_runner.EvaluateJavaScript(
89 'window.__scrollableElementForTelemetry.offsetWidth'))
90 scrollbar_width = float(action_runner.EvaluateJavaScript('''
91 window.__scrollableElementForTelemetry.offsetWidth -
92 window.__scrollableElementForTelemetry.scrollWidth'''))
93
94 # This calculation is correct only when the element doesn't have border or
95 # padding or scroll buttons (eg: gmail mail element).
96 scrollbar_start_mid_y = viewport_height / (2 * content_height)
97 scrollbar_end_mid_y = 1 - scrollbar_start_mid_y
98 scrollbar_mid_x_offset = scrollbar_width / (2 * viewport_width)
99 scrollbar_mid_x = 1 - scrollbar_mid_x_offset
100 return scrollbar_mid_x, scrollbar_start_mid_y, scrollbar_end_mid_y
101
102
62 class GoogleCalendarPage(TopPages): 103 class GoogleCalendarPage(TopPages):
63 104
64 """ Why: productivity, top google properties """ 105 """ Why: productivity, top google properties """
65 106
66 def __init__(self, page_set): 107 def __init__(self, page_set):
67 super(GoogleCalendarPage, self).__init__( 108 super(GoogleCalendarPage, self).__init__(
68 url='https://www.google.com/calendar/', 109 url='https://www.google.com/calendar/',
69 page_set=page_set, 110 page_set=page_set,
70 credentials='google') 111 credentials='google')
71 112
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 url='https://www.google.co.uk/maps/@51.5043968,-0.1526806', 151 url='https://www.google.co.uk/maps/@51.5043968,-0.1526806',
111 page_set=page_set, 152 page_set=page_set,
112 name='Maps') 153 name='Maps')
113 154
114 def RunNavigateSteps(self, action_runner): 155 def RunNavigateSteps(self, action_runner):
115 super(GoogleMapsPage, self).RunNavigateSteps(action_runner) 156 super(GoogleMapsPage, self).RunNavigateSteps(action_runner)
116 action_runner.WaitForElement(selector='.widget-scene-canvas') 157 action_runner.WaitForElement(selector='.widget-scene-canvas')
117 action_runner.WaitForElement(selector='.widget-zoom-in') 158 action_runner.WaitForElement(selector='.widget-zoom-in')
118 action_runner.WaitForElement(selector='.widget-zoom-out') 159 action_runner.WaitForElement(selector='.widget-zoom-out')
119 160
120 # Disabled on android since desktop record of maps doesn't load in android.
121 def CanRunOnBrowser(self, browser_info):
122 return (browser_info._browser._platform_backend.platform.GetOSName() !=
123 'android')
124
125
126 class GooglePlusPage(TopPages): 161 class GooglePlusPage(TopPages):
127 162
128 """ Why: social; top google property; Public profile; infinite scrolls """ 163 """ Why: social; top google property; Public profile; infinite scrolls """
129 164
130 def __init__(self, page_set): 165 def __init__(self, page_set):
131 super(GooglePlusPage, self).__init__( 166 super(GooglePlusPage, self).__init__(
132 url='https://plus.google.com/110031535020051778989/posts', 167 url='https://plus.google.com/110031535020051778989/posts',
133 page_set=page_set, 168 page_set=page_set,
134 credentials='google') 169 credentials='google')
135 170
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 """ Why: #1 games according to Alexa (with actual games in it) """ 309 """ Why: #1 games according to Alexa (with actual games in it) """
275 310
276 def __init__(self, page_set): 311 def __init__(self, page_set):
277 super(YahooGamesPage, self).__init__( 312 super(YahooGamesPage, self).__init__(
278 url='http://games.yahoo.com', 313 url='http://games.yahoo.com',
279 page_set=page_set) 314 page_set=page_set)
280 315
281 def RunNavigateSteps(self, action_runner): 316 def RunNavigateSteps(self, action_runner):
282 super(YahooGamesPage, self).RunNavigateSteps(action_runner) 317 super(YahooGamesPage, self).RunNavigateSteps(action_runner)
283 action_runner.Wait(2) 318 action_runner.Wait(2)
OLDNEW
« no previous file with comments | « tools/perf/page_sets/top_25_smooth.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698