OLD | NEW |
| (Empty) |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 from telemetry.page import page as page_module | |
5 from telemetry.page import page_set as page_set_module | |
6 | |
7 from page_sets import key_mobile_sites_pages | |
8 | |
9 | |
10 class KeyMobileSitesCyclerPage(page_module.Page): | |
11 | |
12 def __init__(self, url, page_set, name='', labels=None, | |
13 action_on_load_complete=False): | |
14 super(KeyMobileSitesCyclerPage, self).__init__( | |
15 url=url, page_set=page_set, name=name, | |
16 credentials_path='data/credentials.json', labels=labels) | |
17 self.user_agent_type = 'mobile' | |
18 self.archive_data_file = 'data/key_mobile_sites.json' | |
19 self.action_on_load_complete = action_on_load_complete | |
20 | |
21 | |
22 class KeyMobileSitesCyclerPageSet(page_set_module.PageSet): | |
23 | |
24 """ Key mobile sites with smooth interactions. """ | |
25 | |
26 def __init__(self): | |
27 super(KeyMobileSitesCyclerPageSet, self).__init__( | |
28 user_agent_type='mobile', | |
29 archive_data_file='data/key_mobile_sites_cycler.json', | |
30 bucket=page_set_module.PARTNER_BUCKET) | |
31 | |
32 | |
33 # Add pages with predefined classes that contain custom navigation logic. | |
34 predefined_page_classes = [ | |
35 key_mobile_sites_pages.CapitolVolkswagenPage, | |
36 key_mobile_sites_pages.TheVergeArticlePage, | |
37 key_mobile_sites_pages.CnnArticlePage, | |
38 key_mobile_sites_pages.FacebookPage, | |
39 key_mobile_sites_pages.YoutubeMobilePage, | |
40 key_mobile_sites_pages.LinkedInPage, | |
41 key_mobile_sites_pages.YahooAnswersPage, | |
42 key_mobile_sites_pages.GoogleNewsMobilePage, | |
43 key_mobile_sites_pages.GoogleNewsMobile2Page, | |
44 key_mobile_sites_pages.AmazonNicolasCagePage, | |
45 ] | |
46 for page_class in predefined_page_classes: | |
47 self.AddUserStory(page_class(self)) | |
48 | |
49 # Add pages with custom page interaction logic. | |
50 | |
51 # Page behaves non-deterministically, replaced with test version for now. | |
52 # self.AddUserStory(GroupClonedPage(self)) | |
53 # mean_input_event_latency cannot be tracked correctly for | |
54 # GroupClonedListImagesPage. | |
55 # See crbug.com/409086. | |
56 # self.AddUserStory(GroupClonedListImagesPage(self)) | |
57 | |
58 # Add pages with custom labels. | |
59 | |
60 # Why: Top news site. | |
61 self.AddUserStory(KeyMobileSitesCyclerPage( | |
62 url='http://nytimes.com/', page_set=self, labels=['fastpath'])) | |
63 | |
64 # Why: Image-heavy site. | |
65 self.AddUserStory(KeyMobileSitesCyclerPage( | |
66 url='http://cuteoverload.com', page_set=self, labels=['fastpath'])) | |
67 | |
68 # Why: #11 (Alexa global), google property; some blogger layouts | |
69 # have infinite scroll but more interesting. | |
70 self.AddUserStory(KeyMobileSitesCyclerPage( | |
71 url='http://googlewebmastercentral.blogspot.com/', | |
72 page_set=self, name='Blogger')) | |
73 | |
74 # Why: #18 (Alexa global), Picked an interesting post """ | |
75 self.AddUserStory(KeyMobileSitesCyclerPage( | |
76 # pylint: disable=line-too-long | |
77 url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks
-for-august-2012/', | |
78 page_set=self, | |
79 name='Wordpress')) | |
80 | |
81 # Why: #6 (Alexa) most visited worldwide, picked an interesting page | |
82 self.AddUserStory(KeyMobileSitesCyclerPage( | |
83 url='http://en.wikipedia.org/wiki/Wikipedia', | |
84 page_set=self, | |
85 name='Wikipedia (1 tab)')) | |
86 | |
87 # Why: Wikipedia page with a delayed scroll start | |
88 self.AddUserStory(KeyMobileSitesCyclerPage( | |
89 url='http://en.wikipedia.org/wiki/Wikipedia', | |
90 page_set=self, | |
91 name='Wikipedia (1 tab) - delayed scroll start', | |
92 action_on_load_complete=True)) | |
93 | |
94 # Why: #8 (Alexa global), picked an interesting page | |
95 # Forbidden (Rate Limit Exceeded) | |
96 # self.AddUserStory(KeyMobileSitesCyclerPage( | |
97 # url='http://twitter.com/katyperry', page_set=self, name='Twitter')) | |
98 | |
99 # Why: #37 (Alexa global) """ | |
100 self.AddUserStory(KeyMobileSitesCyclerPage( | |
101 url='http://pinterest.com', | |
102 page_set=self, | |
103 name='Pinterest')) | |
104 | |
105 # Why: #1 sports. | |
106 # Fails often; crbug.com/249722' | |
107 # self.AddUserStory(KeyMobileSitesCyclerPage( | |
108 # url='http://espn.go.com', page_set=self, name='ESPN')) | |
109 # Why: crbug.com/231413 | |
110 # Doesn't scroll; crbug.com/249736 | |
111 # self.AddUserStory(KeyMobileSitesCyclerPage( | |
112 # url='http://forecast.io', page_set=self)) | |
113 # Why: crbug.com/169827 | |
114 self.AddUserStory(KeyMobileSitesCyclerPage( | |
115 url='http://slashdot.org/', page_set=self, labels=['fastpath'])) | |
116 | |
117 # Why: #5 Alexa news """ | |
118 | |
119 self.AddUserStory(KeyMobileSitesCyclerPage( | |
120 url='http://www.reddit.com/r/programming/comments/1g96ve', | |
121 page_set=self, labels=['fastpath'])) | |
122 | |
123 # Why: Problematic use of fixed position elements """ | |
124 self.AddUserStory(KeyMobileSitesCyclerPage( | |
125 url='http://www.boingboing.net', page_set=self, labels=['fastpath'])) | |
126 | |
127 # Add simple pages with no custom navigation logic or labels. | |
128 urls_list = [ | |
129 # Why: Social; top Google property; Public profile; infinite scrolls. | |
130 # pylint: disable=line-too-long | |
131 'https://plus.google.com/app/basic/110031535020051778989/posts?source=appp
romo', | |
132 # Why: crbug.com/242544 | |
133 ('http://www.androidpolice.com/2012/10/03/rumor-evidence-mounts-that-an-' | |
134 'lg-optimus-g-nexus-is-coming-along-with-a-nexus-phone-certification-' | |
135 'program/'), | |
136 # Why: crbug.com/149958 | |
137 'http://gsp.ro', | |
138 # Why: Top tech blog | |
139 'http://theverge.com', | |
140 # Why: Top tech site | |
141 'http://digg.com', | |
142 # Why: Top Google property; a Google tab is often open | |
143 'https://www.google.com/#hl=en&q=barack+obama', | |
144 # Why: #1 news worldwide (Alexa global) | |
145 'http://news.yahoo.com', | |
146 # Why: #2 news worldwide | |
147 'http://www.cnn.com', | |
148 # Why: #1 commerce website by time spent by users in US | |
149 'http://shop.mobileweb.ebay.com/searchresults?kw=viking+helmet', | |
150 # Why: #1 Alexa recreation | |
151 # pylint: disable=line-too-long | |
152 'http://www.booking.com/searchresults.html?src=searchresults&latitude=65.0
500&longitude=25.4667', | |
153 # Why: #1 Alexa sports | |
154 'http://sports.yahoo.com/', | |
155 # Why: Top tech blog | |
156 'http://techcrunch.com', | |
157 # Why: #6 Alexa sports | |
158 'http://mlb.com/', | |
159 # Why: #14 Alexa California | |
160 'http://www.sfgate.com/', | |
161 # Why: Non-latin character set | |
162 'http://worldjournal.com/', | |
163 # Why: Mobile wiki | |
164 'http://www.wowwiki.com/World_of_Warcraft:_Mists_of_Pandaria', | |
165 # Why: #15 Alexa news | |
166 'http://online.wsj.com/home-page', | |
167 # Why: Image-heavy mobile site | |
168 'http://www.deviantart.com/', | |
169 # Why: Top search engine | |
170 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&' | |
171 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'), | |
172 # Why: Top search engine | |
173 'http://www.bing.com/search?q=sloths', | |
174 # Why: Good example of poor initial scrolling | |
175 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans' | |
176 ] | |
177 | |
178 for url in urls_list: | |
179 self.AddUserStory(KeyMobileSitesCyclerPage(url, self)) | |
OLD | NEW |