| 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 page_sets import fling_gesture_supported_shared_state | 4 from page_sets import fling_gesture_supported_shared_state |
| 5 | 5 from telemetry import story |
| 6 from telemetry.page import page as page_module | 6 from telemetry.page import page as page_module |
| 7 from telemetry.page import page_set as page_set_module | |
| 8 | 7 |
| 9 | 8 |
| 10 class SimpleFlingPage(page_module.Page): | 9 class SimpleFlingPage(page_module.Page): |
| 11 | 10 |
| 12 def __init__(self, url, page_set): | 11 def __init__(self, url, page_set): |
| 13 super(SimpleFlingPage, self).__init__( | 12 super(SimpleFlingPage, self).__init__( |
| 14 url=url, | 13 url=url, |
| 15 page_set=page_set, | 14 page_set=page_set, |
| 16 credentials_path='data/credentials.json', | 15 credentials_path='data/credentials.json', |
| 17 shared_page_state_class=(fling_gesture_supported_shared_state\ | 16 shared_page_state_class=(fling_gesture_supported_shared_state\ |
| 18 .FlingGestureSupportedSharedState)) | 17 .FlingGestureSupportedSharedState)) |
| 19 self.archive_data_file = 'data/simple_mobile_sites.json' | 18 self.archive_data_file = 'data/simple_mobile_sites.json' |
| 20 | 19 |
| 21 def RunNavigateSteps(self, action_runner): | 20 def RunNavigateSteps(self, action_runner): |
| 22 super(SimpleFlingPage, self).RunNavigateSteps(action_runner) | 21 super(SimpleFlingPage, self).RunNavigateSteps(action_runner) |
| 23 # TODO(epenner): Remove this wait (http://crbug.com/366933) | 22 # TODO(epenner): Remove this wait (http://crbug.com/366933) |
| 24 action_runner.Wait(5) | 23 action_runner.Wait(5) |
| 25 | 24 |
| 26 def RunPageInteractions(self, action_runner): | 25 def RunPageInteractions(self, action_runner): |
| 27 with action_runner.CreateGestureInteraction('FlingAction'): | 26 with action_runner.CreateGestureInteraction('FlingAction'): |
| 28 # Swiping up induces a downward fling, and 500 pixels of touch scrolling | 27 # Swiping up induces a downward fling, and 500 pixels of touch scrolling |
| 29 # runway ensures consistent fling velocities. | 28 # runway ensures consistent fling velocities. |
| 30 action_runner.SwipePage(direction='up', | 29 action_runner.SwipePage(direction='up', |
| 31 distance='500', | 30 distance='500', |
| 32 speed_in_pixels_per_second=5000) | 31 speed_in_pixels_per_second=5000) |
| 33 | 32 |
| 34 class SimpleMobileSitesFlingPageSet(page_set_module.PageSet): | 33 class SimpleMobileSitesFlingPageSet(story.StorySet): |
| 35 | 34 |
| 36 """ Simple mobile sites """ | 35 """ Simple mobile sites """ |
| 37 | 36 |
| 38 def __init__(self): | 37 def __init__(self): |
| 39 super(SimpleMobileSitesFlingPageSet, self).__init__( | 38 super(SimpleMobileSitesFlingPageSet, self).__init__( |
| 40 archive_data_file='data/simple_mobile_sites.json', | 39 archive_data_file='data/simple_mobile_sites.json', |
| 41 bucket=page_set_module.PUBLIC_BUCKET) | 40 cloud_storage_bucket=story.PUBLIC_BUCKET) |
| 42 | 41 |
| 43 fling_page_list = [ | 42 fling_page_list = [ |
| 44 # Why: Scrolls moderately complex pages (up to 60 layers) | 43 # Why: Scrolls moderately complex pages (up to 60 layers) |
| 45 'http://www.ebay.co.uk/', | 44 'http://www.ebay.co.uk/', |
| 46 'https://www.flickr.com/', | 45 'https://www.flickr.com/', |
| 47 'http://www.apple.com/mac/', | 46 'http://www.apple.com/mac/', |
| 48 'http://www.nyc.gov', | 47 'http://www.nyc.gov', |
| 49 'http://m.nytimes.com/' | 48 'http://m.nytimes.com/' |
| 50 ] | 49 ] |
| 51 | 50 |
| 52 for url in fling_page_list: | 51 for url in fling_page_list: |
| 53 self.AddUserStory(SimpleFlingPage(url, self)) | 52 self.AddUserStory(SimpleFlingPage(url, self)) |
| 54 | |
| OLD | NEW |