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 import json | 4 import json |
5 import os | 5 import os |
6 | 6 |
| 7 from telemetry import story |
7 from telemetry.page import page as page_module | 8 from telemetry.page import page as page_module |
8 from telemetry.page import page_set as page_set_module | |
9 from telemetry.page import shared_page_state | 9 from telemetry.page import shared_page_state |
10 | 10 |
11 | |
12 __location__ = os.path.realpath( | 11 __location__ = os.path.realpath( |
13 os.path.join(os.getcwd(), os.path.dirname(__file__))) | 12 os.path.join(os.getcwd(), os.path.dirname(__file__))) |
14 | 13 |
15 # Generated on 2013-09-03 13:59:53.459117 by rmistry using | 14 # Generated on 2013-09-03 13:59:53.459117 by rmistry using |
16 # create_page_set.py. | 15 # create_page_set.py. |
17 _TOP_10000_ALEXA_FILE = os.path.join(__location__, 'alexa1-10000-urls.json') | 16 _TOP_10000_ALEXA_FILE = os.path.join(__location__, 'alexa1-10000-urls.json') |
18 | 17 |
19 | 18 |
20 class Alexa1To10000Page(page_module.Page): | 19 class Alexa1To10000Page(page_module.Page): |
21 | 20 |
22 def __init__(self, url, page_set): | 21 def __init__(self, url, page_set): |
23 super(Alexa1To10000Page, self).__init__( | 22 super(Alexa1To10000Page, self).__init__( |
24 url=url, page_set=page_set, | 23 url=url, page_set=page_set, |
25 shared_page_state_class=shared_page_state.SharedDesktopPageState) | 24 shared_page_state_class=shared_page_state.SharedDesktopPageState) |
26 | 25 |
27 def RunPageInteractions(self, action_runner): | 26 def RunPageInteractions(self, action_runner): |
28 with action_runner.CreateGestureInteraction('ScrollAction'): | 27 with action_runner.CreateGestureInteraction('ScrollAction'): |
29 action_runner.ScrollPage() | 28 action_runner.ScrollPage() |
30 | 29 |
31 | 30 |
32 class Alexa1To10000PageSet(page_set_module.PageSet): | 31 class Alexa1To10000PageSet(story.StorySet): |
33 """ Top 1-10000 Alexa global. | 32 """ Top 1-10000 Alexa global. |
34 Generated on 2013-09-03 13:59:53.459117 by rmistry using | 33 Generated on 2013-09-03 13:59:53.459117 by rmistry using |
35 create_page_set.py. | 34 create_page_set.py. |
36 """ | 35 """ |
37 | 36 |
38 def __init__(self): | 37 def __init__(self): |
39 super(Alexa1To10000PageSet, self).__init__() | 38 super(Alexa1To10000PageSet, self).__init__() |
40 | 39 |
41 with open(_TOP_10000_ALEXA_FILE) as f: | 40 with open(_TOP_10000_ALEXA_FILE) as f: |
42 urls_list = json.load(f) | 41 urls_list = json.load(f) |
43 for url in urls_list: | 42 for url in urls_list: |
44 self.AddUserStory(Alexa1To10000Page(url, self)) | 43 self.AddUserStory(Alexa1To10000Page(url, self)) |
OLD | NEW |