| 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 Top25Page(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__(url=url, page_set=page_set, name=name) | 20 super(Top25Page, self).__init__( |
| 21 self.credentials_path = 'data/credentials.json' | 21 url=url, page_set=page_set, name=name, |
| 22 credentials_path='data/credentials.json') |
| 22 self.user_agent_type = 'desktop' | 23 self.user_agent_type = 'desktop' |
| 23 self.archive_data_file = 'data/top_25.json' | 24 self.archive_data_file = 'data/top_25.json' |
| 24 | 25 |
| 25 def RunSmoothness(self, action_runner): | 26 def RunSmoothness(self, action_runner): |
| 26 interaction = action_runner.BeginGestureInteraction( | 27 interaction = action_runner.BeginGestureInteraction( |
| 27 'ScrollAction', is_smooth=True) | 28 'ScrollAction', is_smooth=True) |
| 28 action_runner.ScrollPage() | 29 action_runner.ScrollPage() |
| 29 interaction.End() | 30 interaction.End() |
| 30 | 31 |
| 31 def RunRepaint(self, action_runner): | 32 def RunRepaint(self, action_runner): |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 action_runner.NavigateToPage(self) | 516 action_runner.NavigateToPage(self) |
| 516 action_runner.Wait(2) | 517 action_runner.Wait(2) |
| 517 | 518 |
| 518 | 519 |
| 519 class Top25PageSet(page_set_module.PageSet): | 520 class Top25PageSet(page_set_module.PageSet): |
| 520 | 521 |
| 521 """ Pages hand-picked for 2012 CrOS scrolling tuning efforts. """ | 522 """ Pages hand-picked for 2012 CrOS scrolling tuning efforts. """ |
| 522 | 523 |
| 523 def __init__(self): | 524 def __init__(self): |
| 524 super(Top25PageSet, self).__init__( | 525 super(Top25PageSet, self).__init__( |
| 525 credentials_path='data/credentials.json', | |
| 526 user_agent_type='desktop', | 526 user_agent_type='desktop', |
| 527 archive_data_file='data/top_25.json', | 527 archive_data_file='data/top_25.json', |
| 528 bucket=page_set_module.PARTNER_BUCKET) | 528 bucket=page_set_module.PARTNER_BUCKET) |
| 529 | 529 |
| 530 self.AddPage(GoogleWebSearchPage(self)) | 530 self.AddPage(GoogleWebSearchPage(self)) |
| 531 self.AddPage(GmailPage(self)) | 531 self.AddPage(GmailPage(self)) |
| 532 self.AddPage(GoogleCalendarPage(self)) | 532 self.AddPage(GoogleCalendarPage(self)) |
| 533 self.AddPage(GoogleImageSearchPage(self)) | 533 self.AddPage(GoogleImageSearchPage(self)) |
| 534 self.AddPage(GoogleDocPage(self)) | 534 self.AddPage(GoogleDocPage(self)) |
| 535 self.AddPage(GooglePlusPage(self)) | 535 self.AddPage(GooglePlusPage(self)) |
| (...skipping 24 matching lines...) Expand all 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 |