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 import story |
4 from telemetry.page import page as page_module | 5 from telemetry.page import page as page_module |
5 from telemetry.page import page_set as page_set_module | |
6 from telemetry.page import shared_page_state | 6 from telemetry.page import shared_page_state |
7 | 7 |
8 | 8 |
9 class SimplePage(page_module.Page): | 9 class SimplePage(page_module.Page): |
10 | 10 |
11 def __init__(self, url, page_set): | 11 def __init__(self, url, page_set): |
12 super(SimplePage, self).__init__( | 12 super(SimplePage, self).__init__( |
13 url=url, | 13 url=url, |
14 page_set=page_set, | 14 page_set=page_set, |
15 shared_page_state_class=shared_page_state.Shared10InchTabletPageState, | 15 shared_page_state_class=shared_page_state.Shared10InchTabletPageState, |
16 credentials_path='data/credentials.json') | 16 credentials_path='data/credentials.json') |
17 self.archive_data_file = 'data/simple_mobile_sites.json' | 17 self.archive_data_file = 'data/simple_mobile_sites.json' |
18 | 18 |
19 def RunNavigateSteps(self, action_runner): | 19 def RunNavigateSteps(self, action_runner): |
20 super(SimplePage, self).RunNavigateSteps(action_runner) | 20 super(SimplePage, self).RunNavigateSteps(action_runner) |
21 # TODO(epenner): Remove this wait (http://crbug.com/366933) | 21 # TODO(epenner): Remove this wait (http://crbug.com/366933) |
22 action_runner.Wait(5) | 22 action_runner.Wait(5) |
23 | 23 |
24 class SimpleScrollPage(SimplePage): | 24 class SimpleScrollPage(SimplePage): |
25 | 25 |
26 def __init__(self, url, page_set): | 26 def __init__(self, url, page_set): |
27 super(SimpleScrollPage, self).__init__(url=url, page_set=page_set) | 27 super(SimpleScrollPage, self).__init__(url=url, page_set=page_set) |
28 | 28 |
29 def RunPageInteractions(self, action_runner): | 29 def RunPageInteractions(self, action_runner): |
30 # Make the scroll longer to reduce noise. | 30 # Make the scroll longer to reduce noise. |
31 with action_runner.CreateGestureInteraction('ScrollAction'): | 31 with action_runner.CreateGestureInteraction('ScrollAction'): |
32 action_runner.ScrollPage(direction='down', speed_in_pixels_per_second=300) | 32 action_runner.ScrollPage(direction='down', speed_in_pixels_per_second=300) |
33 | 33 |
34 class SimpleMobileSitesPageSet(page_set_module.PageSet): | 34 class SimpleMobileSitesPageSet(story.StorySet): |
35 | 35 |
36 """ Simple mobile sites """ | 36 """ Simple mobile sites """ |
37 | 37 |
38 def __init__(self): | 38 def __init__(self): |
39 super(SimpleMobileSitesPageSet, self).__init__( | 39 super(SimpleMobileSitesPageSet, self).__init__( |
40 archive_data_file='data/simple_mobile_sites.json', | 40 archive_data_file='data/simple_mobile_sites.json', |
41 bucket=page_set_module.PUBLIC_BUCKET) | 41 cloud_storage_bucket=story.PUBLIC_BUCKET) |
42 | 42 |
43 scroll_page_list = [ | 43 scroll_page_list = [ |
44 # Why: Scrolls moderately complex pages (up to 60 layers) | 44 # Why: Scrolls moderately complex pages (up to 60 layers) |
45 'http://www.ebay.co.uk/', | 45 'http://www.ebay.co.uk/', |
46 'https://www.flickr.com/', | 46 'https://www.flickr.com/', |
47 'http://www.apple.com/mac/', | 47 'http://www.apple.com/mac/', |
48 'http://www.nyc.gov', | 48 'http://www.nyc.gov', |
49 'http://m.nytimes.com/' | 49 'http://m.nytimes.com/' |
50 ] | 50 ] |
51 | 51 |
52 for url in scroll_page_list: | 52 for url in scroll_page_list: |
53 self.AddUserStory(SimpleScrollPage(url, self)) | 53 self.AddUserStory(SimpleScrollPage(url, self)) |
54 | |
OLD | NEW |