| 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 from page_sets import top_pages | 7 from page_sets import top_pages |
| 8 | 8 |
| 9 | 9 |
| 10 def _IssueMarkerAndScroll(action_runner): | 10 def _IssueMarkerAndScroll(action_runner): |
| 11 interaction = action_runner.BeginGestureInteraction( | 11 with action_runner.CreateGestureInteraction('ScrollAction'): |
| 12 'ScrollAction') | 12 action_runner.ScrollPage() |
| 13 action_runner.ScrollPage() | |
| 14 interaction.End() | |
| 15 | 13 |
| 16 | 14 |
| 17 def _CreatePageClassWithSmoothInteractions(page_cls): | 15 def _CreatePageClassWithSmoothInteractions(page_cls): |
| 18 class DerivedSmoothPage(page_cls): # pylint: disable=W0232 | 16 class DerivedSmoothPage(page_cls): # pylint: disable=W0232 |
| 19 | 17 |
| 20 def RunPageInteractions(self, action_runner): | 18 def RunPageInteractions(self, action_runner): |
| 21 _IssueMarkerAndScroll(action_runner) | 19 _IssueMarkerAndScroll(action_runner) |
| 22 return DerivedSmoothPage | 20 return DerivedSmoothPage |
| 23 | 21 |
| 24 | 22 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 39 | 37 |
| 40 """ Why: productivity, top google properties """ | 38 """ Why: productivity, top google properties """ |
| 41 | 39 |
| 42 def RunPageInteractions(self, action_runner): | 40 def RunPageInteractions(self, action_runner): |
| 43 action_runner.ExecuteJavaScript(''' | 41 action_runner.ExecuteJavaScript(''' |
| 44 gmonkey.load('2.0', function(api) { | 42 gmonkey.load('2.0', function(api) { |
| 45 window.__scrollableElementForTelemetry = api.getScrollableElement(); | 43 window.__scrollableElementForTelemetry = api.getScrollableElement(); |
| 46 });''') | 44 });''') |
| 47 action_runner.WaitForJavaScriptCondition( | 45 action_runner.WaitForJavaScriptCondition( |
| 48 'window.__scrollableElementForTelemetry != null') | 46 'window.__scrollableElementForTelemetry != null') |
| 49 interaction = action_runner.BeginGestureInteraction( | 47 with action_runner.CreateGestureInteraction('ScrollAction'): |
| 50 'ScrollAction') | 48 action_runner.ScrollElement( |
| 51 action_runner.ScrollElement( | 49 element_function='window.__scrollableElementForTelemetry') |
| 52 element_function='window.__scrollableElementForTelemetry') | |
| 53 interaction.End() | |
| 54 | 50 |
| 55 | 51 |
| 56 class GoogleCalendarSmoothPage(top_pages.GoogleCalendarPage): | 52 class GoogleCalendarSmoothPage(top_pages.GoogleCalendarPage): |
| 57 | 53 |
| 58 """ Why: productivity, top google properties """ | 54 """ Why: productivity, top google properties """ |
| 59 | 55 |
| 60 def RunPageInteractions(self, action_runner): | 56 def RunPageInteractions(self, action_runner): |
| 61 interaction = action_runner.BeginGestureInteraction( | 57 with action_runner.CreateGestureInteraction('ScrollAction'): |
| 62 'ScrollAction') | 58 action_runner.ScrollElement(selector='#scrolltimedeventswk') |
| 63 action_runner.ScrollElement(selector='#scrolltimedeventswk') | |
| 64 interaction.End() | |
| 65 | 59 |
| 66 | 60 |
| 67 class GoogleDocSmoothPage(top_pages.GoogleDocPage): | 61 class GoogleDocSmoothPage(top_pages.GoogleDocPage): |
| 68 | 62 |
| 69 """ Why: productivity, top google properties; Sample doc in the link """ | 63 """ Why: productivity, top google properties; Sample doc in the link """ |
| 70 | 64 |
| 71 def RunPageInteractions(self, action_runner): | 65 def RunPageInteractions(self, action_runner): |
| 72 interaction = action_runner.BeginGestureInteraction( | 66 with action_runner.CreateGestureInteraction('ScrollAction'): |
| 73 'ScrollAction') | 67 action_runner.ScrollElement(selector='.kix-appview-editor') |
| 74 action_runner.ScrollElement(selector='.kix-appview-editor') | |
| 75 interaction.End() | |
| 76 | 68 |
| 77 | 69 |
| 78 class ESPNSmoothPage(top_pages.ESPNPage): | 70 class ESPNSmoothPage(top_pages.ESPNPage): |
| 79 | 71 |
| 80 """ Why: #1 sports """ | 72 """ Why: #1 sports """ |
| 81 | 73 |
| 82 def RunPageInteractions(self, action_runner): | 74 def RunPageInteractions(self, action_runner): |
| 83 interaction = action_runner.BeginGestureInteraction( | 75 with action_runner.CreateGestureInteraction('ScrollAction'): |
| 84 'ScrollAction') | 76 action_runner.ScrollPage(left_start_ratio=0.1) |
| 85 action_runner.ScrollPage(left_start_ratio=0.1) | |
| 86 interaction.End() | |
| 87 | 77 |
| 88 | 78 |
| 89 class Top25SmoothPageSet(page_set_module.PageSet): | 79 class Top25SmoothPageSet(page_set_module.PageSet): |
| 90 | 80 |
| 91 """ Pages hand-picked for 2012 CrOS scrolling tuning efforts. """ | 81 """ Pages hand-picked for 2012 CrOS scrolling tuning efforts. """ |
| 92 | 82 |
| 93 def __init__(self): | 83 def __init__(self): |
| 94 super(Top25SmoothPageSet, self).__init__( | 84 super(Top25SmoothPageSet, self).__init__( |
| 95 user_agent_type='desktop', | 85 user_agent_type='desktop', |
| 96 archive_data_file='data/top_25_smooth.json', | 86 archive_data_file='data/top_25_smooth.json', |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 # Why: #1 Alexa reference | 132 # Why: #1 Alexa reference |
| 143 'http://answers.yahoo.com', | 133 'http://answers.yahoo.com', |
| 144 # Why: #1 Alexa sports | 134 # Why: #1 Alexa sports |
| 145 'http://sports.yahoo.com/', | 135 'http://sports.yahoo.com/', |
| 146 # Why: top tech blog | 136 # Why: top tech blog |
| 147 'http://techcrunch.com' | 137 'http://techcrunch.com' |
| 148 ] | 138 ] |
| 149 | 139 |
| 150 for url in other_urls: | 140 for url in other_urls: |
| 151 self.AddUserStory(TopSmoothPage(url, self)) | 141 self.AddUserStory(TopSmoothPage(url, self)) |
| OLD | NEW |