| 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 shared_page_state | 5 from telemetry.page import shared_page_state |
| 6 from telemetry import story | 6 from telemetry import story |
| 7 | 7 |
| 8 from page_sets.login_helpers import google_login | 8 from page_sets.login_helpers import google_login |
| 9 from page_sets import top_pages | 9 from page_sets import top_pages |
| 10 | 10 |
| 11 | 11 |
| 12 def _IssueMarkerAndScroll(action_runner): | 12 def _IssueMarkerAndScroll(action_runner): |
| 13 with action_runner.CreateGestureInteraction('ScrollAction'): | 13 with action_runner.CreateGestureInteraction('ScrollAction'): |
| 14 action_runner.ScrollPage() | 14 action_runner.ScrollPage() |
| 15 | 15 |
| 16 | 16 |
| 17 def _CreatePageClassWithSmoothInteractions(page_cls): | 17 def _CreatePageClassWithSmoothInteractions(page_cls): |
| 18 class DerivedSmoothPage(page_cls): # pylint: disable=no-init | 18 class DerivedSmoothPage(page_cls): # pylint: disable=no-init |
| 19 | 19 |
| 20 def RunPageInteractions(self, action_runner): | 20 def RunPageInteractions(self, action_runner): |
| 21 action_runner.Wait(1) |
| 21 _IssueMarkerAndScroll(action_runner) | 22 _IssueMarkerAndScroll(action_runner) |
| 22 return DerivedSmoothPage | 23 return DerivedSmoothPage |
| 23 | 24 |
| 24 | 25 |
| 25 class TopSmoothPage(page_module.Page): | 26 class TopSmoothPage(page_module.Page): |
| 26 | 27 |
| 27 def __init__(self, url, page_set, name='', credentials=None): | 28 def __init__(self, url, page_set, name='', credentials=None): |
| 28 super(TopSmoothPage, self).__init__( | 29 super(TopSmoothPage, self).__init__( |
| 29 url=url, page_set=page_set, name=name, | 30 url=url, page_set=page_set, name=name, |
| 30 shared_page_state_class=shared_page_state.SharedDesktopPageState, | 31 shared_page_state_class=shared_page_state.SharedDesktopPageState, |
| 31 credentials_path='data/credentials.json') | 32 credentials_path='data/credentials.json') |
| 32 self.credentials = credentials | 33 self.credentials = credentials |
| 33 | 34 |
| 34 def RunPageInteractions(self, action_runner): | 35 def RunPageInteractions(self, action_runner): |
| 36 action_runner.Wait(1) |
| 35 _IssueMarkerAndScroll(action_runner) | 37 _IssueMarkerAndScroll(action_runner) |
| 36 | 38 |
| 37 | 39 |
| 38 class GmailSmoothPage(top_pages.TopPages): | 40 class GmailSmoothPage(top_pages.TopPages): |
| 39 | 41 |
| 40 """ Why: productivity, top google properties """ | 42 """ Why: productivity, top google properties """ |
| 41 | 43 |
| 42 def __init__(self, page_set, | 44 def __init__(self, page_set, |
| 43 shared_page_state_class=shared_page_state.SharedPageState): | 45 shared_page_state_class=shared_page_state.SharedPageState): |
| 44 # TODO(flackr): This is duplicating page logic from top_pages.py but is | 46 # TODO(flackr): This is duplicating page logic from top_pages.py but is |
| (...skipping 15 matching lines...) Expand all Loading... |
| 60 'document.getElementById("gb") !== null', | 62 'document.getElementById("gb") !== null', |
| 61 timeout_in_seconds=120) | 63 timeout_in_seconds=120) |
| 62 | 64 |
| 63 def RunPageInteractions(self, action_runner): | 65 def RunPageInteractions(self, action_runner): |
| 64 action_runner.ExecuteJavaScript(''' | 66 action_runner.ExecuteJavaScript(''' |
| 65 gmonkey.load('2.0', function(api) { | 67 gmonkey.load('2.0', function(api) { |
| 66 window.__scrollableElementForTelemetry = api.getScrollableElement(); | 68 window.__scrollableElementForTelemetry = api.getScrollableElement(); |
| 67 });''') | 69 });''') |
| 68 action_runner.WaitForJavaScriptCondition( | 70 action_runner.WaitForJavaScriptCondition( |
| 69 'window.__scrollableElementForTelemetry != null') | 71 'window.__scrollableElementForTelemetry != null') |
| 72 action_runner.Wait(1) |
| 70 with action_runner.CreateGestureInteraction('ScrollAction'): | 73 with action_runner.CreateGestureInteraction('ScrollAction'): |
| 71 action_runner.ScrollElement( | 74 action_runner.ScrollElement( |
| 72 element_function='window.__scrollableElementForTelemetry') | 75 element_function='window.__scrollableElementForTelemetry') |
| 73 | 76 |
| 74 | 77 |
| 75 class GoogleCalendarSmoothPage(top_pages.GoogleCalendarPage): | 78 class GoogleCalendarSmoothPage(top_pages.GoogleCalendarPage): |
| 76 | 79 |
| 77 """ Why: productivity, top google properties """ | 80 """ Why: productivity, top google properties """ |
| 78 | 81 |
| 79 def RunPageInteractions(self, action_runner): | 82 def RunPageInteractions(self, action_runner): |
| 83 action_runner.Wait(1) |
| 80 with action_runner.CreateGestureInteraction('ScrollAction'): | 84 with action_runner.CreateGestureInteraction('ScrollAction'): |
| 81 action_runner.ScrollElement(selector='#scrolltimedeventswk') | 85 action_runner.ScrollElement(selector='#scrolltimedeventswk') |
| 82 | 86 |
| 83 | 87 |
| 84 class GoogleDocSmoothPage(top_pages.GoogleDocPage): | 88 class GoogleDocSmoothPage(top_pages.GoogleDocPage): |
| 85 | 89 |
| 86 """ Why: productivity, top google properties; Sample doc in the link """ | 90 """ Why: productivity, top google properties; Sample doc in the link """ |
| 87 | 91 |
| 88 def RunPageInteractions(self, action_runner): | 92 def RunPageInteractions(self, action_runner): |
| 93 action_runner.Wait(1) |
| 89 with action_runner.CreateGestureInteraction('ScrollAction'): | 94 with action_runner.CreateGestureInteraction('ScrollAction'): |
| 90 action_runner.ScrollElement(selector='.kix-appview-editor') | 95 action_runner.ScrollElement(selector='.kix-appview-editor') |
| 91 | 96 |
| 92 | 97 |
| 93 class ESPNSmoothPage(top_pages.ESPNPage): | 98 class ESPNSmoothPage(top_pages.ESPNPage): |
| 94 | 99 |
| 95 """ Why: #1 sports """ | 100 """ Why: #1 sports """ |
| 96 | 101 |
| 97 def RunPageInteractions(self, action_runner): | 102 def RunPageInteractions(self, action_runner): |
| 103 action_runner.Wait(1) |
| 98 with action_runner.CreateGestureInteraction('ScrollAction'): | 104 with action_runner.CreateGestureInteraction('ScrollAction'): |
| 99 action_runner.ScrollPage(left_start_ratio=0.1) | 105 action_runner.ScrollPage(left_start_ratio=0.1) |
| 100 | 106 |
| 101 | 107 |
| 102 class Top25SmoothPageSet(story.StorySet): | 108 class Top25SmoothPageSet(story.StorySet): |
| 103 | 109 |
| 104 """ Pages hand-picked for 2012 CrOS scrolling tuning efforts. """ | 110 """ Pages hand-picked for 2012 CrOS scrolling tuning efforts. """ |
| 105 | 111 |
| 106 def __init__(self, techcrunch=True): | 112 def __init__(self, techcrunch=True): |
| 107 super(Top25SmoothPageSet, self).__init__( | 113 super(Top25SmoothPageSet, self).__init__( |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 other_urls.append('http://techcrunch.com') | 171 other_urls.append('http://techcrunch.com') |
| 166 | 172 |
| 167 for url in other_urls: | 173 for url in other_urls: |
| 168 self.AddStory(TopSmoothPage(url, self)) | 174 self.AddStory(TopSmoothPage(url, self)) |
| 169 | 175 |
| 170 | 176 |
| 171 class V8Top25SmoothPageSet(Top25SmoothPageSet): | 177 class V8Top25SmoothPageSet(Top25SmoothPageSet): |
| 172 def __init__(self): | 178 def __init__(self): |
| 173 # Disabled for V8 because of crbug.com/507836, crbug.com/527425 | 179 # Disabled for V8 because of crbug.com/507836, crbug.com/527425 |
| 174 super(V8Top25SmoothPageSet, self).__init__(techcrunch=False) | 180 super(V8Top25SmoothPageSet, self).__init__(techcrunch=False) |
| OLD | NEW |