Chromium Code Reviews| 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 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 | 38 |
| 39 def __init__(self, page_set): | 39 def __init__(self, page_set): |
| 40 super(GoogleWebSearchPage, self).__init__( | 40 super(GoogleWebSearchPage, self).__init__( |
| 41 url='https://www.google.com/#hl=en&q=barack+obama', | 41 url='https://www.google.com/#hl=en&q=barack+obama', |
| 42 page_set=page_set) | 42 page_set=page_set) |
| 43 | 43 |
| 44 def RunNavigateSteps(self, action_runner): | 44 def RunNavigateSteps(self, action_runner): |
| 45 action_runner.NavigateToPage(self) | 45 action_runner.NavigateToPage(self) |
| 46 action_runner.WaitForElement(text='Next') | 46 action_runner.WaitForElement(text='Next') |
| 47 | 47 |
| 48 def RunStressMemory(self, action_runner): | 48 def RunPageInteractions(self, action_runner): |
|
tonyg
2014/10/06 21:06:36
This was a nice, general purpose page set. But now
nednguyen
2014/10/06 21:40:40
The coupling already exists with these RunStressMe
nduca
2014/10/07 17:46:48
backin gup... maybe the thing to think of here is
| |
| 49 interaction = action_runner.BeginGestureInteraction( | 49 interaction = action_runner.BeginGestureInteraction( |
| 50 'ScrollAction', is_smooth=True) | 50 'ScrollAction', is_smooth=True) |
| 51 action_runner.ScrollPage() | 51 action_runner.ScrollPage() |
| 52 interaction.End() | 52 interaction.End() |
| 53 old_href = _GetCurrentLocation(action_runner) | 53 old_href = _GetCurrentLocation(action_runner) |
| 54 action_runner.ClickElement(text='Next') | 54 action_runner.ClickElement(text='Next') |
| 55 _WaitForLocationChange(action_runner, old_href) | 55 _WaitForLocationChange(action_runner, old_href) |
| 56 action_runner.WaitForElement(text='Next') | 56 action_runner.WaitForElement(text='Next') |
| 57 interaction = action_runner.BeginGestureInteraction( | 57 interaction = action_runner.BeginGestureInteraction( |
| 58 'ScrollAction', is_smooth=True) | 58 'ScrollAction', is_smooth=True) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 page_set=page_set) | 114 page_set=page_set) |
| 115 | 115 |
| 116 self.credentials = 'google' | 116 self.credentials = 'google' |
| 117 | 117 |
| 118 def RunNavigateSteps(self, action_runner): | 118 def RunNavigateSteps(self, action_runner): |
| 119 action_runner.NavigateToPage(self) | 119 action_runner.NavigateToPage(self) |
| 120 action_runner.WaitForJavaScriptCondition( | 120 action_runner.WaitForJavaScriptCondition( |
| 121 'window.gmonkey !== undefined &&' | 121 'window.gmonkey !== undefined &&' |
| 122 'document.getElementById("gb") !== null') | 122 'document.getElementById("gb") !== null') |
| 123 | 123 |
| 124 def RunStressMemory(self, action_runner): | 124 def RunPageInteractions(self, action_runner): |
| 125 old_href = _GetCurrentLocation(action_runner) | 125 old_href = _GetCurrentLocation(action_runner) |
| 126 action_runner.ClickElement( | 126 action_runner.ClickElement( |
| 127 'a[href="https://mail.google.com/mail/u/0/?shva=1#starred"]') | 127 'a[href="https://mail.google.com/mail/u/0/?shva=1#starred"]') |
| 128 _WaitForLocationChange(action_runner, old_href) | 128 _WaitForLocationChange(action_runner, old_href) |
| 129 old_href = _GetCurrentLocation(action_runner) | 129 old_href = _GetCurrentLocation(action_runner) |
| 130 action_runner.ClickElement( | 130 action_runner.ClickElement( |
| 131 'a[href="https://mail.google.com/mail/u/0/?shva=1#inbox"]') | 131 'a[href="https://mail.google.com/mail/u/0/?shva=1#inbox"]') |
| 132 _WaitForLocationChange(action_runner, old_href) | 132 _WaitForLocationChange(action_runner, old_href) |
| 133 | 133 |
| 134 def RunSmoothness(self, action_runner): | 134 def RunSmoothness(self, action_runner): |
|
tonyg
2014/10/06 21:06:36
Case-in point, I'm not sure how we're going to han
nednguyen
2014/10/06 21:40:41
In the short term, we will keep the general top_25
| |
| 135 action_runner.ExecuteJavaScript(''' | 135 action_runner.ExecuteJavaScript(''' |
| 136 gmonkey.load('2.0', function(api) { | 136 gmonkey.load('2.0', function(api) { |
| 137 window.__scrollableElementForTelemetry = api.getScrollableElement(); | 137 window.__scrollableElementForTelemetry = api.getScrollableElement(); |
| 138 });''') | 138 });''') |
| 139 action_runner.WaitForJavaScriptCondition( | 139 action_runner.WaitForJavaScriptCondition( |
| 140 'window.__scrollableElementForTelemetry != null') | 140 'window.__scrollableElementForTelemetry != null') |
| 141 interaction = action_runner.BeginGestureInteraction( | 141 interaction = action_runner.BeginGestureInteraction( |
| 142 'ScrollAction', is_smooth=True) | 142 'ScrollAction', is_smooth=True) |
| 143 action_runner.ScrollElement( | 143 action_runner.ScrollElement( |
| 144 element_function='window.__scrollableElementForTelemetry') | 144 element_function='window.__scrollableElementForTelemetry') |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 162 action_runner.WaitForElement('div[class~="navForward"]') | 162 action_runner.WaitForElement('div[class~="navForward"]') |
| 163 action_runner.ExecuteJavaScript(''' | 163 action_runner.ExecuteJavaScript(''' |
| 164 (function() { | 164 (function() { |
| 165 var elem = document.createElement('meta'); | 165 var elem = document.createElement('meta'); |
| 166 elem.name='viewport'; | 166 elem.name='viewport'; |
| 167 elem.content='initial-scale=1'; | 167 elem.content='initial-scale=1'; |
| 168 document.body.appendChild(elem); | 168 document.body.appendChild(elem); |
| 169 })();''') | 169 })();''') |
| 170 action_runner.Wait(1) | 170 action_runner.Wait(1) |
| 171 | 171 |
| 172 def RunStressMemory(self, action_runner): | 172 def RunPageInteractions(self, action_runner): |
| 173 action_runner.ClickElement('div[class~="navForward"]') | 173 action_runner.ClickElement('div[class~="navForward"]') |
| 174 action_runner.Wait(2) | 174 action_runner.Wait(2) |
| 175 action_runner.WaitForElement('div[class~="navForward"]') | 175 action_runner.WaitForElement('div[class~="navForward"]') |
| 176 action_runner.ClickElement('div[class~="navForward"]') | 176 action_runner.ClickElement('div[class~="navForward"]') |
| 177 action_runner.Wait(2) | 177 action_runner.Wait(2) |
| 178 action_runner.WaitForElement('div[class~="navForward"]') | 178 action_runner.WaitForElement('div[class~="navForward"]') |
| 179 action_runner.ClickElement('div[class~="navForward"]') | 179 action_runner.ClickElement('div[class~="navForward"]') |
| 180 action_runner.Wait(2) | 180 action_runner.Wait(2) |
| 181 action_runner.WaitForElement('div[class~="navForward"]') | 181 action_runner.WaitForElement('div[class~="navForward"]') |
| 182 action_runner.ClickElement('div[class~="navForward"]') | 182 action_runner.ClickElement('div[class~="navForward"]') |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 super(GooglePlusPage, self).__init__( | 248 super(GooglePlusPage, self).__init__( |
| 249 url='https://plus.google.com/110031535020051778989/posts', | 249 url='https://plus.google.com/110031535020051778989/posts', |
| 250 page_set=page_set) | 250 page_set=page_set) |
| 251 | 251 |
| 252 self.credentials = 'google' | 252 self.credentials = 'google' |
| 253 | 253 |
| 254 def RunNavigateSteps(self, action_runner): | 254 def RunNavigateSteps(self, action_runner): |
| 255 action_runner.NavigateToPage(self) | 255 action_runner.NavigateToPage(self) |
| 256 action_runner.WaitForElement(text='Home') | 256 action_runner.WaitForElement(text='Home') |
| 257 | 257 |
| 258 def RunStressMemory(self, action_runner): | 258 def RunPageInteractions(self, action_runner): |
| 259 action_runner.ClickElement(text='Home') | 259 action_runner.ClickElement(text='Home') |
| 260 action_runner.Wait(2) | 260 action_runner.Wait(2) |
| 261 action_runner.WaitForElement(text='Profile') | 261 action_runner.WaitForElement(text='Profile') |
| 262 action_runner.ClickElement(text='Profile') | 262 action_runner.ClickElement(text='Profile') |
| 263 action_runner.Wait(2) | 263 action_runner.Wait(2) |
| 264 action_runner.WaitForElement(text='Explore') | 264 action_runner.WaitForElement(text='Explore') |
| 265 action_runner.ClickElement(text='Explore') | 265 action_runner.ClickElement(text='Explore') |
| 266 action_runner.Wait(2) | 266 action_runner.Wait(2) |
| 267 action_runner.WaitForElement(text='Events') | 267 action_runner.WaitForElement(text='Events') |
| 268 action_runner.ClickElement(text='Events') | 268 action_runner.ClickElement(text='Events') |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 def __init__(self, page_set): | 303 def __init__(self, page_set): |
| 304 super(BlogspotPage, self).__init__( | 304 super(BlogspotPage, self).__init__( |
| 305 url='http://googlewebmastercentral.blogspot.com/', | 305 url='http://googlewebmastercentral.blogspot.com/', |
| 306 page_set=page_set, | 306 page_set=page_set, |
| 307 name='Blogger') | 307 name='Blogger') |
| 308 | 308 |
| 309 def RunNavigateSteps(self, action_runner): | 309 def RunNavigateSteps(self, action_runner): |
| 310 action_runner.NavigateToPage(self) | 310 action_runner.NavigateToPage(self) |
| 311 action_runner.WaitForElement(text='accessibility') | 311 action_runner.WaitForElement(text='accessibility') |
| 312 | 312 |
| 313 def RunStressMemory(self, action_runner): | 313 def RunPageInteractions(self, action_runner): |
| 314 action_runner.ClickElement(text='accessibility') | 314 action_runner.ClickElement(text='accessibility') |
| 315 action_runner.WaitForNavigate() | 315 action_runner.WaitForNavigate() |
| 316 interaction = action_runner.BeginGestureInteraction( | 316 interaction = action_runner.BeginGestureInteraction( |
| 317 'ScrollAction', is_smooth=True) | 317 'ScrollAction', is_smooth=True) |
| 318 action_runner.ScrollPage() | 318 action_runner.ScrollPage() |
| 319 interaction.End() | 319 interaction.End() |
| 320 action_runner.ClickElement(text='advanced') | 320 action_runner.ClickElement(text='advanced') |
| 321 action_runner.WaitForNavigate() | 321 action_runner.WaitForNavigate() |
| 322 interaction = action_runner.BeginGestureInteraction( | 322 interaction = action_runner.BeginGestureInteraction( |
| 323 'ScrollAction', is_smooth=True) | 323 'ScrollAction', is_smooth=True) |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 343 url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks -for-august-2012/', | 343 url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks -for-august-2012/', |
| 344 page_set=page_set, | 344 page_set=page_set, |
| 345 name='Wordpress') | 345 name='Wordpress') |
| 346 | 346 |
| 347 def RunNavigateSteps(self, action_runner): | 347 def RunNavigateSteps(self, action_runner): |
| 348 action_runner.NavigateToPage(self) | 348 action_runner.NavigateToPage(self) |
| 349 action_runner.WaitForElement( | 349 action_runner.WaitForElement( |
| 350 # pylint: disable=C0301 | 350 # pylint: disable=C0301 |
| 351 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sig ht/"]') | 351 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sig ht/"]') |
| 352 | 352 |
| 353 def RunStressMemory(self, action_runner): | 353 def RunPageInteractions(self, action_runner): |
| 354 interaction = action_runner.BeginGestureInteraction( | 354 interaction = action_runner.BeginGestureInteraction( |
| 355 'ScrollAction', is_smooth=True) | 355 'ScrollAction', is_smooth=True) |
| 356 action_runner.ScrollPage() | 356 action_runner.ScrollPage() |
| 357 interaction.End() | 357 interaction.End() |
| 358 action_runner.ClickElement( | 358 action_runner.ClickElement( |
| 359 # pylint: disable=C0301 | 359 # pylint: disable=C0301 |
| 360 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sig ht/"]') | 360 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sig ht/"]') |
| 361 action_runner.WaitForNavigate() | 361 action_runner.WaitForNavigate() |
| 362 interaction = action_runner.BeginGestureInteraction( | 362 interaction = action_runner.BeginGestureInteraction( |
| 363 'ScrollAction', is_smooth=True) | 363 'ScrollAction', is_smooth=True) |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 385 super(FacebookPage, self).__init__( | 385 super(FacebookPage, self).__init__( |
| 386 url='http://www.facebook.com/barackobama', | 386 url='http://www.facebook.com/barackobama', |
| 387 page_set=page_set, | 387 page_set=page_set, |
| 388 name='Facebook') | 388 name='Facebook') |
| 389 self.credentials = 'facebook' | 389 self.credentials = 'facebook' |
| 390 | 390 |
| 391 def RunNavigateSteps(self, action_runner): | 391 def RunNavigateSteps(self, action_runner): |
| 392 action_runner.NavigateToPage(self) | 392 action_runner.NavigateToPage(self) |
| 393 action_runner.WaitForElement(text='About') | 393 action_runner.WaitForElement(text='About') |
| 394 | 394 |
| 395 def RunStressMemory(self, action_runner): | 395 def RunPageInteractions(self, action_runner): |
| 396 action_runner.ClickElement(text='About') | 396 action_runner.ClickElement(text='About') |
| 397 action_runner.WaitForNavigate() | 397 action_runner.WaitForNavigate() |
| 398 action_runner.ClickElement(text='The Audacity of Hope') | 398 action_runner.ClickElement(text='The Audacity of Hope') |
| 399 action_runner.WaitForNavigate() | 399 action_runner.WaitForNavigate() |
| 400 action_runner.ClickElement(text='Back to Barack Obama\'s Timeline') | 400 action_runner.ClickElement(text='Back to Barack Obama\'s Timeline') |
| 401 action_runner.WaitForNavigate() | 401 action_runner.WaitForNavigate() |
| 402 action_runner.ClickElement(text='About') | 402 action_runner.ClickElement(text='About') |
| 403 action_runner.WaitForNavigate() | 403 action_runner.WaitForNavigate() |
| 404 action_runner.ClickElement(text='Elected to U.S. Senate') | 404 action_runner.ClickElement(text='Elected to U.S. Senate') |
| 405 action_runner.WaitForNavigate() | 405 action_runner.WaitForNavigate() |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 560 # Why: #1 Alexa reference | 560 # Why: #1 Alexa reference |
| 561 'http://answers.yahoo.com', | 561 'http://answers.yahoo.com', |
| 562 # Why: #1 Alexa sports | 562 # Why: #1 Alexa sports |
| 563 'http://sports.yahoo.com/', | 563 'http://sports.yahoo.com/', |
| 564 # Why: top tech blog | 564 # Why: top tech blog |
| 565 'http://techcrunch.com' | 565 'http://techcrunch.com' |
| 566 ] | 566 ] |
| 567 | 567 |
| 568 for url in other_urls: | 568 for url in other_urls: |
| 569 self.AddPage(Top25Page(url, self)) | 569 self.AddPage(Top25Page(url, self)) |
| OLD | NEW |