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