OLD | NEW |
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 | 7 |
8 def _GetCurrentLocation(action_runner): | 8 def _GetCurrentLocation(action_runner): |
9 return action_runner.EvaluateJavaScript('document.location.href') | 9 return action_runner.EvaluateJavaScript('document.location.href') |
10 | 10 |
11 | 11 |
12 def _WaitForLocationChange(action_runner, old_href): | 12 def _WaitForLocationChange(action_runner, old_href): |
13 action_runner.WaitForJavaScriptCondition( | 13 action_runner.WaitForJavaScriptCondition( |
14 'document.location.href != "%s"' % old_href) | 14 'document.location.href != "%s"' % old_href) |
15 | 15 |
16 | 16 |
17 class Top25Page(page_module.Page): | 17 class Top7StressPage(page_module.Page): |
18 | 18 |
19 def __init__(self, url, page_set, name=''): | 19 def __init__(self, url, page_set, name=''): |
20 super(Top25Page, self).__init__( | 20 super(Top7StressPage, self).__init__( |
21 url=url, page_set=page_set, name=name, | 21 url=url, page_set=page_set, name=name, |
22 credentials_path='data/credentials.json') | 22 credentials_path = 'data/credentials.json') |
23 self.user_agent_type = 'desktop' | 23 self.user_agent_type = 'desktop' |
24 self.archive_data_file = 'data/top_25.json' | 24 self.archive_data_file = 'data/top_25.json' |
25 | 25 |
26 def RunSmoothness(self, action_runner): | 26 def RunPageInteractions(self, action_runner): |
27 interaction = action_runner.BeginGestureInteraction( | 27 raise NotImplementedError() |
28 'ScrollAction', is_smooth=True) | |
29 action_runner.ScrollPage() | |
30 interaction.End() | |
31 | |
32 def RunRepaint(self, action_runner): | |
33 action_runner.RepaintContinuously(seconds=5) | |
34 | 28 |
35 | 29 |
36 class GoogleWebSearchPage(Top25Page): | 30 class GoogleWebSearchPage(Top7StressPage): |
37 | 31 |
38 """ Why: top google property; a google tab is often open """ | 32 """ Why: top google property; a google tab is often open """ |
39 | 33 |
40 def __init__(self, page_set): | 34 def __init__(self, page_set): |
41 super(GoogleWebSearchPage, self).__init__( | 35 super(GoogleWebSearchPage, self).__init__( |
42 url='https://www.google.com/#hl=en&q=barack+obama', | 36 url='https://www.google.com/#hl=en&q=barack+obama', |
43 page_set=page_set) | 37 page_set=page_set) |
44 | 38 |
45 def RunNavigateSteps(self, action_runner): | 39 def RunNavigateSteps(self, action_runner): |
46 action_runner.NavigateToPage(self) | 40 action_runner.NavigateToPage(self) |
47 action_runner.WaitForElement(text='Next') | 41 action_runner.WaitForElement(text='Next') |
48 | 42 |
49 def RunStressMemory(self, action_runner): | 43 def RunPageInteractions(self, action_runner): |
50 interaction = action_runner.BeginGestureInteraction( | 44 interaction = action_runner.BeginGestureInteraction( |
51 'ScrollAction', is_smooth=True) | 45 'ScrollAction', is_smooth=True) |
52 action_runner.ScrollPage() | 46 action_runner.ScrollPage() |
53 interaction.End() | 47 interaction.End() |
54 old_href = _GetCurrentLocation(action_runner) | 48 old_href = _GetCurrentLocation(action_runner) |
55 action_runner.ClickElement(text='Next') | 49 action_runner.ClickElement(text='Next') |
56 _WaitForLocationChange(action_runner, old_href) | 50 _WaitForLocationChange(action_runner, old_href) |
57 action_runner.WaitForElement(text='Next') | 51 action_runner.WaitForElement(text='Next') |
58 interaction = action_runner.BeginGestureInteraction( | 52 interaction = action_runner.BeginGestureInteraction( |
59 'ScrollAction', is_smooth=True) | 53 'ScrollAction', is_smooth=True) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 interaction = action_runner.BeginGestureInteraction( | 92 interaction = action_runner.BeginGestureInteraction( |
99 'ScrollAction', is_smooth=True) | 93 'ScrollAction', is_smooth=True) |
100 action_runner.ScrollPage() | 94 action_runner.ScrollPage() |
101 interaction.End() | 95 interaction.End() |
102 old_href = _GetCurrentLocation(action_runner) | 96 old_href = _GetCurrentLocation(action_runner) |
103 action_runner.ClickElement(text='Images') | 97 action_runner.ClickElement(text='Images') |
104 _WaitForLocationChange(action_runner, old_href) | 98 _WaitForLocationChange(action_runner, old_href) |
105 action_runner.WaitForElement(text='Images') | 99 action_runner.WaitForElement(text='Images') |
106 | 100 |
107 | 101 |
108 class GmailPage(Top25Page): | 102 class GmailPage(Top7StressPage): |
109 | 103 |
110 """ Why: productivity, top google properties """ | 104 """ Why: productivity, top google properties """ |
111 | 105 |
112 def __init__(self, page_set): | 106 def __init__(self, page_set): |
113 super(GmailPage, self).__init__( | 107 super(GmailPage, self).__init__( |
114 url='https://mail.google.com/mail/', | 108 url='https://mail.google.com/mail/', |
115 page_set=page_set) | 109 page_set=page_set) |
116 | 110 |
117 self.credentials = 'google' | 111 self.credentials = 'google' |
118 | 112 |
119 def RunNavigateSteps(self, action_runner): | 113 def RunNavigateSteps(self, action_runner): |
120 action_runner.NavigateToPage(self) | 114 action_runner.NavigateToPage(self) |
121 action_runner.WaitForJavaScriptCondition( | 115 action_runner.WaitForJavaScriptCondition( |
122 'window.gmonkey !== undefined &&' | 116 'window.gmonkey !== undefined &&' |
123 'document.getElementById("gb") !== null') | 117 'document.getElementById("gb") !== null') |
124 | 118 |
125 def RunStressMemory(self, action_runner): | 119 def RunPageInteractions(self, action_runner): |
126 old_href = _GetCurrentLocation(action_runner) | 120 old_href = _GetCurrentLocation(action_runner) |
127 action_runner.ClickElement( | 121 action_runner.ClickElement( |
128 'a[href="https://mail.google.com/mail/u/0/?shva=1#starred"]') | 122 'a[href="https://mail.google.com/mail/u/0/?shva=1#starred"]') |
129 _WaitForLocationChange(action_runner, old_href) | 123 _WaitForLocationChange(action_runner, old_href) |
130 old_href = _GetCurrentLocation(action_runner) | 124 old_href = _GetCurrentLocation(action_runner) |
131 action_runner.ClickElement( | 125 action_runner.ClickElement( |
132 'a[href="https://mail.google.com/mail/u/0/?shva=1#inbox"]') | 126 'a[href="https://mail.google.com/mail/u/0/?shva=1#inbox"]') |
133 _WaitForLocationChange(action_runner, old_href) | 127 _WaitForLocationChange(action_runner, old_href) |
134 | 128 |
135 def RunSmoothness(self, action_runner): | |
136 action_runner.ExecuteJavaScript(''' | |
137 gmonkey.load('2.0', function(api) { | |
138 window.__scrollableElementForTelemetry = api.getScrollableElement(); | |
139 });''') | |
140 action_runner.WaitForJavaScriptCondition( | |
141 'window.__scrollableElementForTelemetry != null') | |
142 interaction = action_runner.BeginGestureInteraction( | |
143 'ScrollAction', is_smooth=True) | |
144 action_runner.ScrollElement( | |
145 element_function='window.__scrollableElementForTelemetry') | |
146 interaction.End() | |
147 | 129 |
148 | 130 class GoogleCalendarPage(Top7StressPage): |
149 class GoogleCalendarPage(Top25Page): | |
150 | 131 |
151 """ Why: productivity, top google properties """ | 132 """ Why: productivity, top google properties """ |
152 | 133 |
153 def __init__(self, page_set): | 134 def __init__(self, page_set): |
154 super(GoogleCalendarPage, self).__init__( | 135 super(GoogleCalendarPage, self).__init__( |
155 url='https://www.google.com/calendar/', | 136 url='https://www.google.com/calendar/', |
156 page_set=page_set) | 137 page_set=page_set) |
157 | 138 |
158 self.credentials = 'google' | 139 self.credentials = 'google' |
159 | 140 |
160 def RunNavigateSteps(self, action_runner): | 141 def RunNavigateSteps(self, action_runner): |
161 action_runner.NavigateToPage(self) | 142 action_runner.NavigateToPage(self) |
162 action_runner.Wait(2) | 143 action_runner.Wait(2) |
163 action_runner.WaitForElement('div[class~="navForward"]') | 144 action_runner.WaitForElement('div[class~="navForward"]') |
164 action_runner.ExecuteJavaScript(''' | 145 action_runner.ExecuteJavaScript(''' |
165 (function() { | 146 (function() { |
166 var elem = document.createElement('meta'); | 147 var elem = document.createElement('meta'); |
167 elem.name='viewport'; | 148 elem.name='viewport'; |
168 elem.content='initial-scale=1'; | 149 elem.content='initial-scale=1'; |
169 document.body.appendChild(elem); | 150 document.body.appendChild(elem); |
170 })();''') | 151 })();''') |
171 action_runner.Wait(1) | 152 action_runner.Wait(1) |
172 | 153 |
173 def RunStressMemory(self, action_runner): | 154 def RunPageInteractions(self, action_runner): |
174 action_runner.ClickElement('div[class~="navForward"]') | 155 action_runner.ClickElement('div[class~="navForward"]') |
175 action_runner.Wait(2) | 156 action_runner.Wait(2) |
176 action_runner.WaitForElement('div[class~="navForward"]') | 157 action_runner.WaitForElement('div[class~="navForward"]') |
177 action_runner.ClickElement('div[class~="navForward"]') | 158 action_runner.ClickElement('div[class~="navForward"]') |
178 action_runner.Wait(2) | 159 action_runner.Wait(2) |
179 action_runner.WaitForElement('div[class~="navForward"]') | 160 action_runner.WaitForElement('div[class~="navForward"]') |
180 action_runner.ClickElement('div[class~="navForward"]') | 161 action_runner.ClickElement('div[class~="navForward"]') |
181 action_runner.Wait(2) | 162 action_runner.Wait(2) |
182 action_runner.WaitForElement('div[class~="navForward"]') | 163 action_runner.WaitForElement('div[class~="navForward"]') |
183 action_runner.ClickElement('div[class~="navForward"]') | 164 action_runner.ClickElement('div[class~="navForward"]') |
184 action_runner.Wait(2) | 165 action_runner.Wait(2) |
185 action_runner.WaitForElement('div[class~="navBack"]') | 166 action_runner.WaitForElement('div[class~="navBack"]') |
186 action_runner.ClickElement('div[class~="navBack"]') | 167 action_runner.ClickElement('div[class~="navBack"]') |
187 action_runner.Wait(2) | 168 action_runner.Wait(2) |
188 action_runner.WaitForElement('div[class~="navBack"]') | 169 action_runner.WaitForElement('div[class~="navBack"]') |
189 action_runner.ClickElement('div[class~="navBack"]') | 170 action_runner.ClickElement('div[class~="navBack"]') |
190 action_runner.Wait(2) | 171 action_runner.Wait(2) |
191 action_runner.WaitForElement('div[class~="navBack"]') | 172 action_runner.WaitForElement('div[class~="navBack"]') |
192 action_runner.ClickElement('div[class~="navBack"]') | 173 action_runner.ClickElement('div[class~="navBack"]') |
193 action_runner.Wait(2) | 174 action_runner.Wait(2) |
194 action_runner.WaitForElement('div[class~="navBack"]') | 175 action_runner.WaitForElement('div[class~="navBack"]') |
195 action_runner.ClickElement('div[class~="navBack"]') | 176 action_runner.ClickElement('div[class~="navBack"]') |
196 action_runner.Wait(2) | 177 action_runner.Wait(2) |
197 action_runner.WaitForElement('div[class~="navBack"]') | 178 action_runner.WaitForElement('div[class~="navBack"]') |
198 | 179 |
199 def RunSmoothness(self, action_runner): | |
200 interaction = action_runner.BeginGestureInteraction( | |
201 'ScrollAction', is_smooth=True) | |
202 action_runner.ScrollElement(selector='#scrolltimedeventswk') | |
203 interaction.End() | |
204 | 180 |
205 | 181 class GooglePlusPage(Top7StressPage): |
206 class GoogleImageSearchPage(Top25Page): | |
207 | |
208 """ Why: tough image case; top google properties """ | |
209 | |
210 def __init__(self, page_set): | |
211 super(GoogleImageSearchPage, self).__init__( | |
212 url='https://www.google.com/search?q=cats&tbm=isch', | |
213 page_set=page_set) | |
214 | |
215 self.credentials = 'google' | |
216 | |
217 | |
218 class GoogleDocPage(Top25Page): | |
219 | |
220 """ Why: productivity, top google properties; Sample doc in the link """ | |
221 | |
222 def __init__(self, page_set): | |
223 super(GoogleDocPage, self).__init__( | |
224 # pylint: disable=C0301 | |
225 url='https://docs.google.com/document/d/1X-IKNjtEnx-WW5JIKRLsyhz5sbsat3mfT
pAPUSX3_s4/view', | |
226 page_set=page_set, | |
227 name='Docs (1 open document tab)') | |
228 | |
229 self.credentials = 'google' | |
230 | |
231 def RunNavigateSteps(self, action_runner): | |
232 action_runner.NavigateToPage(self) | |
233 action_runner.Wait(2) | |
234 action_runner.WaitForJavaScriptCondition( | |
235 'document.getElementsByClassName("kix-appview-editor").length') | |
236 | |
237 def RunSmoothness(self, action_runner): | |
238 interaction = action_runner.BeginGestureInteraction( | |
239 'ScrollAction', is_smooth=True) | |
240 action_runner.ScrollElement(selector='.kix-appview-editor') | |
241 interaction.End() | |
242 | |
243 | |
244 class GooglePlusPage(Top25Page): | |
245 | 182 |
246 """ Why: social; top google property; Public profile; infinite scrolls """ | 183 """ Why: social; top google property; Public profile; infinite scrolls """ |
247 | 184 |
248 def __init__(self, page_set): | 185 def __init__(self, page_set): |
249 super(GooglePlusPage, self).__init__( | 186 super(GooglePlusPage, self).__init__( |
250 url='https://plus.google.com/110031535020051778989/posts', | 187 url='https://plus.google.com/110031535020051778989/posts', |
251 page_set=page_set) | 188 page_set=page_set) |
252 | 189 |
253 self.credentials = 'google' | 190 self.credentials = 'google' |
254 | 191 |
255 def RunNavigateSteps(self, action_runner): | 192 def RunNavigateSteps(self, action_runner): |
256 action_runner.NavigateToPage(self) | 193 action_runner.NavigateToPage(self) |
257 action_runner.WaitForElement(text='Home') | 194 action_runner.WaitForElement(text='Home') |
258 | 195 |
259 def RunStressMemory(self, action_runner): | 196 def RunPageInteractions(self, action_runner): |
260 action_runner.ClickElement(text='Home') | 197 action_runner.ClickElement(text='Home') |
261 action_runner.Wait(2) | 198 action_runner.Wait(2) |
262 action_runner.WaitForElement(text='Profile') | 199 action_runner.WaitForElement(text='Profile') |
263 action_runner.ClickElement(text='Profile') | 200 action_runner.ClickElement(text='Profile') |
264 action_runner.Wait(2) | 201 action_runner.Wait(2) |
265 action_runner.WaitForElement(text='Explore') | 202 action_runner.WaitForElement(text='Explore') |
266 action_runner.ClickElement(text='Explore') | 203 action_runner.ClickElement(text='Explore') |
267 action_runner.Wait(2) | 204 action_runner.Wait(2) |
268 action_runner.WaitForElement(text='Events') | 205 action_runner.WaitForElement(text='Events') |
269 action_runner.ClickElement(text='Events') | 206 action_runner.ClickElement(text='Events') |
270 action_runner.Wait(2) | 207 action_runner.Wait(2) |
271 action_runner.WaitForElement(text='Communities') | 208 action_runner.WaitForElement(text='Communities') |
272 action_runner.ClickElement(text='Communities') | 209 action_runner.ClickElement(text='Communities') |
273 action_runner.Wait(2) | 210 action_runner.Wait(2) |
274 action_runner.WaitForElement(text='Home') | 211 action_runner.WaitForElement(text='Home') |
275 | 212 |
276 def RunSmoothness(self, action_runner): | |
277 interaction = action_runner.BeginGestureInteraction( | |
278 'ScrollAction', is_smooth=True) | |
279 action_runner.ScrollPage() | |
280 interaction.End() | |
281 | 213 |
282 | 214 class BlogspotPage(Top7StressPage): |
283 class YoutubePage(Top25Page): | |
284 | |
285 """ Why: #3 (Alexa global) """ | |
286 | |
287 def __init__(self, page_set): | |
288 super(YoutubePage, self).__init__( | |
289 url='http://www.youtube.com', | |
290 page_set=page_set) | |
291 | |
292 self.credentials = 'google' | |
293 | |
294 def RunNavigateSteps(self, action_runner): | |
295 action_runner.NavigateToPage(self) | |
296 action_runner.Wait(2) | |
297 | |
298 | |
299 class BlogspotPage(Top25Page): | |
300 | 215 |
301 """ Why: #11 (Alexa global), google property; some blogger layouts have | 216 """ Why: #11 (Alexa global), google property; some blogger layouts have |
302 infinite scroll but more interesting """ | 217 infinite scroll but more interesting """ |
303 | 218 |
304 def __init__(self, page_set): | 219 def __init__(self, page_set): |
305 super(BlogspotPage, self).__init__( | 220 super(BlogspotPage, self).__init__( |
306 url='http://googlewebmastercentral.blogspot.com/', | 221 url='http://googlewebmastercentral.blogspot.com/', |
307 page_set=page_set, | 222 page_set=page_set, |
308 name='Blogger') | 223 name='Blogger') |
309 | 224 |
310 def RunNavigateSteps(self, action_runner): | 225 def RunNavigateSteps(self, action_runner): |
311 action_runner.NavigateToPage(self) | 226 action_runner.NavigateToPage(self) |
312 action_runner.WaitForElement(text='accessibility') | 227 action_runner.WaitForElement(text='accessibility') |
313 | 228 |
314 def RunStressMemory(self, action_runner): | 229 def RunPageInteractions(self, action_runner): |
315 action_runner.ClickElement(text='accessibility') | 230 action_runner.ClickElement(text='accessibility') |
316 action_runner.WaitForNavigate() | 231 action_runner.WaitForNavigate() |
317 interaction = action_runner.BeginGestureInteraction( | 232 interaction = action_runner.BeginGestureInteraction( |
318 'ScrollAction', is_smooth=True) | 233 'ScrollAction', is_smooth=True) |
319 action_runner.ScrollPage() | 234 action_runner.ScrollPage() |
320 interaction.End() | 235 interaction.End() |
321 action_runner.ClickElement(text='advanced') | 236 action_runner.ClickElement(text='advanced') |
322 action_runner.WaitForNavigate() | 237 action_runner.WaitForNavigate() |
323 interaction = action_runner.BeginGestureInteraction( | 238 interaction = action_runner.BeginGestureInteraction( |
324 'ScrollAction', is_smooth=True) | 239 'ScrollAction', is_smooth=True) |
325 action_runner.ScrollPage() | 240 action_runner.ScrollPage() |
326 interaction.End() | 241 interaction.End() |
327 action_runner.ClickElement(text='beginner') | 242 action_runner.ClickElement(text='beginner') |
328 action_runner.WaitForNavigate() | 243 action_runner.WaitForNavigate() |
329 interaction = action_runner.BeginGestureInteraction( | 244 interaction = action_runner.BeginGestureInteraction( |
330 'ScrollAction', is_smooth=True) | 245 'ScrollAction', is_smooth=True) |
331 action_runner.ScrollPage() | 246 action_runner.ScrollPage() |
332 interaction.End() | 247 interaction.End() |
333 action_runner.ClickElement(text='Home') | 248 action_runner.ClickElement(text='Home') |
334 action_runner.WaitForNavigate() | 249 action_runner.WaitForNavigate() |
335 | 250 |
336 | 251 |
337 class WordpressPage(Top25Page): | 252 class WordpressPage(Top7StressPage): |
338 | 253 |
339 """ Why: #18 (Alexa global), Picked an interesting post """ | 254 """ Why: #18 (Alexa global), Picked an interesting post """ |
340 | 255 |
341 def __init__(self, page_set): | 256 def __init__(self, page_set): |
342 super(WordpressPage, self).__init__( | 257 super(WordpressPage, self).__init__( |
343 # pylint: disable=C0301 | 258 # pylint: disable=C0301 |
344 url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks
-for-august-2012/', | 259 url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks
-for-august-2012/', |
345 page_set=page_set, | 260 page_set=page_set, |
346 name='Wordpress') | 261 name='Wordpress') |
347 | 262 |
348 def RunNavigateSteps(self, action_runner): | 263 def RunNavigateSteps(self, action_runner): |
349 action_runner.NavigateToPage(self) | 264 action_runner.NavigateToPage(self) |
350 action_runner.WaitForElement( | 265 action_runner.WaitForElement( |
351 # pylint: disable=C0301 | 266 # pylint: disable=C0301 |
352 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sig
ht/"]') | 267 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sig
ht/"]') |
353 | 268 |
354 def RunStressMemory(self, action_runner): | 269 def RunPageInteractions(self, action_runner): |
355 interaction = action_runner.BeginGestureInteraction( | 270 interaction = action_runner.BeginGestureInteraction( |
356 'ScrollAction', is_smooth=True) | 271 'ScrollAction', is_smooth=True) |
357 action_runner.ScrollPage() | 272 action_runner.ScrollPage() |
358 interaction.End() | 273 interaction.End() |
359 action_runner.ClickElement( | 274 action_runner.ClickElement( |
360 # pylint: disable=C0301 | 275 # pylint: disable=C0301 |
361 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sig
ht/"]') | 276 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sig
ht/"]') |
362 action_runner.WaitForNavigate() | 277 action_runner.WaitForNavigate() |
363 interaction = action_runner.BeginGestureInteraction( | 278 interaction = action_runner.BeginGestureInteraction( |
364 'ScrollAction', is_smooth=True) | 279 'ScrollAction', is_smooth=True) |
365 action_runner.ScrollPage() | 280 action_runner.ScrollPage() |
366 interaction.End() | 281 interaction.End() |
367 action_runner.ClickElement(text='Features') | 282 action_runner.ClickElement(text='Features') |
368 action_runner.WaitForNavigate() | 283 action_runner.WaitForNavigate() |
369 interaction = action_runner.BeginGestureInteraction( | 284 interaction = action_runner.BeginGestureInteraction( |
370 'ScrollAction', is_smooth=True) | 285 'ScrollAction', is_smooth=True) |
371 action_runner.ScrollPage() | 286 action_runner.ScrollPage() |
372 interaction.End() | 287 interaction.End() |
373 action_runner.ClickElement(text='News') | 288 action_runner.ClickElement(text='News') |
374 action_runner.WaitForNavigate() | 289 action_runner.WaitForNavigate() |
375 interaction = action_runner.BeginGestureInteraction( | 290 interaction = action_runner.BeginGestureInteraction( |
376 'ScrollAction', is_smooth=True) | 291 'ScrollAction', is_smooth=True) |
377 action_runner.ScrollPage() | 292 action_runner.ScrollPage() |
378 interaction.End() | 293 interaction.End() |
379 | 294 |
380 | 295 |
381 class FacebookPage(Top25Page): | 296 class FacebookPage(Top7StressPage): |
382 | 297 |
383 """ Why: top social,Public profile """ | 298 """ Why: top social,Public profile """ |
384 | 299 |
385 def __init__(self, page_set): | 300 def __init__(self, page_set): |
386 super(FacebookPage, self).__init__( | 301 super(FacebookPage, self).__init__( |
387 url='http://www.facebook.com/barackobama', | 302 url='http://www.facebook.com/barackobama', |
388 page_set=page_set, | 303 page_set=page_set, |
389 name='Facebook') | 304 name='Facebook') |
390 self.credentials = 'facebook' | 305 self.credentials = 'facebook' |
391 | 306 |
392 def RunNavigateSteps(self, action_runner): | 307 def RunNavigateSteps(self, action_runner): |
393 action_runner.NavigateToPage(self) | 308 action_runner.NavigateToPage(self) |
394 action_runner.WaitForElement(text='About') | 309 action_runner.WaitForElement(text='About') |
395 | 310 |
396 def RunStressMemory(self, action_runner): | 311 def RunPageInteractions(self, action_runner): |
397 action_runner.ClickElement(text='About') | 312 action_runner.ClickElement(text='About') |
398 action_runner.WaitForNavigate() | 313 action_runner.WaitForNavigate() |
399 action_runner.ClickElement(text='The Audacity of Hope') | 314 action_runner.ClickElement(text='The Audacity of Hope') |
400 action_runner.WaitForNavigate() | 315 action_runner.WaitForNavigate() |
401 action_runner.ClickElement(text='Back to Barack Obama\'s Timeline') | 316 action_runner.ClickElement(text='Back to Barack Obama\'s Timeline') |
402 action_runner.WaitForNavigate() | 317 action_runner.WaitForNavigate() |
403 action_runner.ClickElement(text='About') | 318 action_runner.ClickElement(text='About') |
404 action_runner.WaitForNavigate() | 319 action_runner.WaitForNavigate() |
405 action_runner.ClickElement(text='Elected to U.S. Senate') | 320 action_runner.ClickElement(text='Elected to U.S. Senate') |
406 action_runner.WaitForNavigate() | 321 action_runner.WaitForNavigate() |
407 action_runner.ClickElement(text='Home') | 322 action_runner.ClickElement(text='Home') |
408 action_runner.WaitForNavigate() | 323 action_runner.WaitForNavigate() |
409 | 324 |
410 def RunSmoothness(self, action_runner): | |
411 interaction = action_runner.BeginGestureInteraction( | |
412 'ScrollAction', is_smooth=True) | |
413 action_runner.ScrollPage() | |
414 interaction.End() | |
415 | 325 |
| 326 class Top7StressPageSet(page_set_module.PageSet): |
416 | 327 |
417 class LinkedinPage(Top25Page): | 328 """ Pages hand-picked for stress testing. """ |
418 | |
419 """ Why: #12 (Alexa global),Public profile """ | |
420 | |
421 def __init__(self, page_set): | |
422 super(LinkedinPage, self).__init__( | |
423 url='http://www.linkedin.com/in/linustorvalds', | |
424 page_set=page_set, | |
425 name='LinkedIn') | |
426 | |
427 | |
428 class WikipediaPage(Top25Page): | |
429 | |
430 """ Why: #6 (Alexa) most visited worldwide,Picked an interesting page """ | |
431 | |
432 def __init__(self, page_set): | |
433 super(WikipediaPage, self).__init__( | |
434 url='http://en.wikipedia.org/wiki/Wikipedia', | |
435 page_set=page_set, | |
436 name='Wikipedia (1 tab)') | |
437 | |
438 | |
439 class TwitterPage(Top25Page): | |
440 | |
441 """ Why: #8 (Alexa global),Picked an interesting page """ | |
442 | |
443 def __init__(self, page_set): | |
444 super(TwitterPage, self).__init__( | |
445 url='https://twitter.com/katyperry', | |
446 page_set=page_set, | |
447 name='Twitter') | |
448 | |
449 def RunNavigateSteps(self, action_runner): | |
450 action_runner.NavigateToPage(self) | |
451 action_runner.Wait(2) | |
452 | |
453 def RunSmoothness(self, action_runner): | |
454 interaction = action_runner.BeginGestureInteraction( | |
455 'ScrollAction', is_smooth=True) | |
456 action_runner.ScrollPage() | |
457 interaction.End() | |
458 | |
459 | |
460 class PinterestPage(Top25Page): | |
461 | |
462 """ Why: #37 (Alexa global) """ | |
463 | |
464 def __init__(self, page_set): | |
465 super(PinterestPage, self).__init__( | |
466 url='http://pinterest.com', | |
467 page_set=page_set, | |
468 name='Pinterest') | |
469 | |
470 def RunSmoothness(self, action_runner): | |
471 interaction = action_runner.BeginGestureInteraction( | |
472 'ScrollAction', is_smooth=True) | |
473 action_runner.ScrollPage() | |
474 interaction.End() | |
475 | |
476 | |
477 class ESPNPage(Top25Page): | |
478 | |
479 """ Why: #1 sports """ | |
480 | |
481 def __init__(self, page_set): | |
482 super(ESPNPage, self).__init__( | |
483 url='http://espn.go.com', | |
484 page_set=page_set, | |
485 name='ESPN') | |
486 | |
487 def RunSmoothness(self, action_runner): | |
488 interaction = action_runner.BeginGestureInteraction( | |
489 'ScrollAction', is_smooth=True) | |
490 action_runner.ScrollPage(left_start_ratio=0.1) | |
491 interaction.End() | |
492 | |
493 | |
494 class WeatherDotComPage(Top25Page): | |
495 | |
496 """ Why: #7 (Alexa news); #27 total time spent,Picked interesting page """ | |
497 | |
498 def __init__(self, page_set): | |
499 super(WeatherDotComPage, self).__init__( | |
500 # pylint: disable=C0301 | |
501 url='http://www.weather.com/weather/right-now/Mountain+View+CA+94043', | |
502 page_set=page_set, | |
503 name='Weather.com') | |
504 | |
505 | |
506 class YahooGamesPage(Top25Page): | |
507 | |
508 """ Why: #1 games according to Alexa (with actual games in it) """ | |
509 | |
510 def __init__(self, page_set): | |
511 super(YahooGamesPage, self).__init__( | |
512 url='http://games.yahoo.com', | |
513 page_set=page_set) | |
514 | |
515 def RunNavigateSteps(self, action_runner): | |
516 action_runner.NavigateToPage(self) | |
517 action_runner.Wait(2) | |
518 | |
519 | |
520 class Top25PageSet(page_set_module.PageSet): | |
521 | |
522 """ Pages hand-picked for 2012 CrOS scrolling tuning efforts. """ | |
523 | 329 |
524 def __init__(self): | 330 def __init__(self): |
525 super(Top25PageSet, self).__init__( | 331 super(Top7StressPageSet, self).__init__( |
526 user_agent_type='desktop', | 332 user_agent_type='desktop', |
527 archive_data_file='data/top_25.json', | 333 archive_data_file='data/top_25.json', |
528 bucket=page_set_module.PARTNER_BUCKET) | 334 bucket=page_set_module.PARTNER_BUCKET) |
529 | 335 |
530 self.AddPage(GoogleWebSearchPage(self)) | 336 self.AddPage(GoogleWebSearchPage(self)) |
531 self.AddPage(GmailPage(self)) | 337 self.AddPage(GmailPage(self)) |
532 self.AddPage(GoogleCalendarPage(self)) | 338 self.AddPage(GoogleCalendarPage(self)) |
533 self.AddPage(GoogleImageSearchPage(self)) | |
534 self.AddPage(GoogleDocPage(self)) | |
535 self.AddPage(GooglePlusPage(self)) | 339 self.AddPage(GooglePlusPage(self)) |
536 self.AddPage(YoutubePage(self)) | |
537 self.AddPage(BlogspotPage(self)) | 340 self.AddPage(BlogspotPage(self)) |
538 self.AddPage(WordpressPage(self)) | 341 self.AddPage(WordpressPage(self)) |
539 self.AddPage(FacebookPage(self)) | 342 self.AddPage(FacebookPage(self)) |
540 self.AddPage(LinkedinPage(self)) | |
541 self.AddPage(WikipediaPage(self)) | |
542 self.AddPage(TwitterPage(self)) | |
543 self.AddPage(PinterestPage(self)) | |
544 self.AddPage(ESPNPage(self)) | |
545 self.AddPage(WeatherDotComPage(self)) | |
546 self.AddPage(YahooGamesPage(self)) | |
547 | |
548 other_urls = [ | |
549 # Why: #1 news worldwide (Alexa global) | |
550 'http://news.yahoo.com', | |
551 # Why: #2 news worldwide | |
552 'http://www.cnn.com', | |
553 # Why: #1 world commerce website by visits; #3 commerce in the US by time | |
554 # spent | |
555 'http://www.amazon.com', | |
556 # Why: #1 commerce website by time spent by users in US | |
557 'http://www.ebay.com', | |
558 # Why: #1 Alexa recreation | |
559 'http://booking.com', | |
560 # Why: #1 Alexa reference | |
561 'http://answers.yahoo.com', | |
562 # Why: #1 Alexa sports | |
563 'http://sports.yahoo.com/', | |
564 # Why: top tech blog | |
565 'http://techcrunch.com' | |
566 ] | |
567 | |
568 for url in other_urls: | |
569 self.AddPage(Top25Page(url, self)) | |
OLD | NEW |