[Telemetry] Split top_25 to top_25_smooth and top_25_repaint
[chromium-blink-merge.git] / tools / perf / page_sets / top_pages.py
blob8856e41a1ab49ab1e993954eb655a8b3688781e1
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
7 class TopPages(page_module.Page):
9 def __init__(self, url, page_set, name='', credentials=None):
10 super(TopPages, self).__init__(
11 url=url, page_set=page_set, name=name,
12 credentials_path='data/credentials.json')
13 self.user_agent_type = 'desktop'
14 self.archive_data_file = 'data/top_25.json'
15 self.credentials = credentials
18 class GoogleWebSearchPage(TopPages):
20 """ Why: top google property; a google tab is often open """
22 def __init__(self, page_set):
23 super(GoogleWebSearchPage, self).__init__(
24 url='https://www.google.com/#hl=en&q=barack+obama',
25 page_set=page_set)
27 def RunNavigateSteps(self, action_runner):
28 action_runner.NavigateToPage(self)
29 action_runner.WaitForElement(text='Next')
32 class GoogleImageSearchPage(TopPages):
34 """ Why: tough image case; top google properties """
36 def __init__(self, page_set):
37 super(GoogleImageSearchPage, self).__init__(
38 'https://www.google.com/search?q=cats&tbm=isch',
39 page_set=page_set, credentials='google')
42 class GmailPage(TopPages):
44 """ Why: productivity, top google properties """
46 def __init__(self, page_set):
47 super(GmailPage, self).__init__(
48 url='https://mail.google.com/mail/',
49 page_set=page_set,
50 credentials='google')
52 def RunNavigateSteps(self, action_runner):
53 action_runner.NavigateToPage(self)
54 action_runner.WaitForJavaScriptCondition(
55 'window.gmonkey !== undefined &&'
56 'document.getElementById("gb") !== null')
59 class GoogleCalendarPage(TopPages):
61 """ Why: productivity, top google properties """
63 def __init__(self, page_set):
64 super(GoogleCalendarPage, self).__init__(
65 url='https://www.google.com/calendar/',
66 page_set=page_set,
67 credentials='google')
69 def RunNavigateSteps(self, action_runner):
70 action_runner.NavigateToPage(self)
71 action_runner.Wait(2)
72 action_runner.WaitForElement('div[class~="navForward"]')
73 action_runner.ExecuteJavaScript('''
74 (function() {
75 var elem = document.createElement('meta');
76 elem.name='viewport';
77 elem.content='initial-scale=1';
78 document.body.appendChild(elem);
79 })();''')
80 action_runner.Wait(1)
83 class GoogleDocPage(TopPages):
85 """ Why: productivity, top google properties; Sample doc in the link """
87 def __init__(self, page_set):
88 super(GoogleDocPage, self).__init__(
89 # pylint: disable=C0301
90 url='https://docs.google.com/document/d/1X-IKNjtEnx-WW5JIKRLsyhz5sbsat3mfTpAPUSX3_s4/view',
91 page_set=page_set,
92 name='Docs (1 open document tab)',
93 credentials='google')
95 def RunNavigateSteps(self, action_runner):
96 action_runner.NavigateToPage(self)
97 action_runner.Wait(2)
98 action_runner.WaitForJavaScriptCondition(
99 'document.getElementsByClassName("kix-appview-editor").length')
102 class GooglePlusPage(TopPages):
104 """ Why: social; top google property; Public profile; infinite scrolls """
106 def __init__(self, page_set):
107 super(GooglePlusPage, self).__init__(
108 url='https://plus.google.com/110031535020051778989/posts',
109 page_set=page_set,
110 credentials='google')
112 def RunNavigateSteps(self, action_runner):
113 action_runner.NavigateToPage(self)
114 action_runner.WaitForElement(text='Home')
117 class YoutubePage(TopPages):
119 """ Why: #3 (Alexa global) """
121 def __init__(self, page_set):
122 super(YoutubePage, self).__init__(
123 url='http://www.youtube.com',
124 page_set=page_set, credentials='google')
126 def RunNavigateSteps(self, action_runner):
127 action_runner.NavigateToPage(self)
128 action_runner.Wait(2)
131 class BlogspotPage(TopPages):
133 """ Why: #11 (Alexa global), google property; some blogger layouts have
134 infinite scroll but more interesting """
136 def __init__(self, page_set):
137 super(BlogspotPage, self).__init__(
138 url='http://googlewebmastercentral.blogspot.com/',
139 page_set=page_set,
140 name='Blogger')
142 def RunNavigateSteps(self, action_runner):
143 action_runner.NavigateToPage(self)
144 action_runner.WaitForElement(text='accessibility')
147 class WordpressPage(TopPages):
149 """ Why: #18 (Alexa global), Picked an interesting post """
151 def __init__(self, page_set):
152 super(WordpressPage, self).__init__(
153 # pylint: disable=C0301
154 url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks-for-august-2012/',
155 page_set=page_set,
156 name='Wordpress')
158 def RunNavigateSteps(self, action_runner):
159 action_runner.NavigateToPage(self)
160 action_runner.WaitForElement(
161 # pylint: disable=C0301
162 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sight/"]')
165 class FacebookPage(TopPages):
167 """ Why: top social,Public profile """
169 def __init__(self, page_set):
170 super(FacebookPage, self).__init__(
171 url='https://www.facebook.com/barackobama',
172 page_set=page_set,
173 name='Facebook', credentials='facebook2')
175 def RunNavigateSteps(self, action_runner):
176 action_runner.NavigateToPage(self)
177 action_runner.WaitForElement(text='About')
180 class LinkedinPage(TopPages):
182 """ Why: #12 (Alexa global), Public profile. """
184 def __init__(self, page_set):
185 super(LinkedinPage, self).__init__(
186 url='http://www.linkedin.com/in/linustorvalds', page_set=page_set,
187 name='LinkedIn')
190 class WikipediaPage(TopPages):
192 """ Why: #6 (Alexa) most visited worldwide,Picked an interesting page. """
194 def __init__(self, page_set):
195 super(WikipediaPage, self).__init__(
196 url='http://en.wikipedia.org/wiki/Wikipedia', page_set=page_set,
197 name='Wikipedia (1 tab)')
200 class TwitterPage(TopPages):
202 """ Why: #8 (Alexa global),Picked an interesting page """
204 def __init__(self, page_set):
205 super(TwitterPage, self).__init__(
206 url='https://twitter.com/katyperry',
207 page_set=page_set,
208 name='Twitter')
210 def RunNavigateSteps(self, action_runner):
211 action_runner.NavigateToPage(self)
212 action_runner.Wait(2)
215 class PinterestPage(TopPages):
217 """ Why: #37 (Alexa global) """
219 def __init__(self, page_set):
220 super(PinterestPage, self).__init__(
221 url='http://pinterest.com',
222 page_set=page_set,
223 name='Pinterest')
226 class ESPNPage(TopPages):
228 """ Why: #1 sports """
230 def __init__(self, page_set):
231 super(ESPNPage, self).__init__(
232 url='http://espn.go.com',
233 page_set=page_set,
234 name='ESPN')
237 class WeatherPage(TopPages):
239 """ Why: #7 (Alexa news); #27 total time spent, picked interesting page. """
241 def __init__(self, page_set):
242 super(WeatherPage, self).__init__(
243 url='http://www.weather.com/weather/right-now/Mountain+View+CA+94043',
244 page_set=page_set,
245 name='Weather.com')
248 class YahooGamesPage(TopPages):
250 """ Why: #1 games according to Alexa (with actual games in it) """
252 def __init__(self, page_set):
253 super(YahooGamesPage, self).__init__(
254 url='http://games.yahoo.com',
255 page_set=page_set)
257 def RunNavigateSteps(self, action_runner):
258 action_runner.NavigateToPage(self)
259 action_runner.Wait(2)