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