Change next_proto member type.
[chromium-blink-merge.git] / tools / perf / page_sets / top_10.py
blob4297b19fe95da86ba7e2d3a25101f1597cbc0576
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 page_set as page_set_module
8 class SimpleScrollPage(page_module.Page):
9 def __init__(self, url, page_set, credentials='', name=''):
10 super(SimpleScrollPage, self).__init__(
11 url, page_set=page_set, name=name,
12 credentials_path='data/credentials.json')
13 self.credentials = credentials
15 def RunSmoothness(self, action_runner):
16 interaction = action_runner.BeginGestureInteraction(
17 'ScrollAction', is_smooth=True)
18 action_runner.ScrollPage()
19 interaction.End()
21 class Google(SimpleScrollPage):
22 def __init__(self, page_set):
23 super(Google, self).__init__(
24 url='https://www.google.com/#hl=en&q=barack+obama', page_set=page_set)
26 def RunNavigateSteps(self, action_runner):
27 super(Google, self).RunNavigateSteps(action_runner)
28 action_runner.WaitForElement(text='Next')
31 class Gmail(SimpleScrollPage):
32 def __init__(self, page_set):
33 super(Gmail, self).__init__(
34 url='https://mail.google.com/mail/',
35 page_set=page_set,
36 credentials='google')
38 def RunNavigateSteps(self, action_runner):
39 super(Gmail, self).RunNavigateSteps(action_runner)
40 action_runner.WaitForJavaScriptCondition(
41 'window.gmonkey !== undefined &&'
42 'document.getElementById("gb") !== null')
45 class GoogleCalendar(SimpleScrollPage):
46 def __init__(self, page_set):
47 super(GoogleCalendar, self).__init__(
48 url='https://www.google.com/calendar/',
49 page_set=page_set,
50 credentials='google')
52 def RunNavigateSteps(self, action_runner):
53 super(GoogleCalendar, self).RunNavigateSteps(action_runner)
54 action_runner.ExecuteJavaScript('''
55 (function() { var elem = document.createElement("meta");
56 elem.name="viewport";
57 elem.content="initial-scale=1";
58 document.body.appendChild(elem);
59 })();''')
60 action_runner.Wait(2)
61 action_runner.WaitForElement('div[class~="navForward"]')
64 class Youtube(SimpleScrollPage):
65 def __init__(self, page_set):
66 super(Youtube, self).__init__(
67 url='http://www.youtube.com',
68 page_set=page_set,
69 credentials='google')
71 def RunNavigateSteps(self, action_runner):
72 super(Youtube, self).RunNavigateSteps(action_runner)
73 action_runner.Wait(2)
76 class Facebook(SimpleScrollPage):
77 def __init__(self, page_set):
78 super(Facebook, self).__init__(
79 url='http://www.facebook.com/barackobama',
80 page_set=page_set,
81 credentials='facebook',
82 name='Facebook')
84 def RunNavigateSteps(self, action_runner):
85 super(Facebook, self).RunNavigateSteps(action_runner)
86 action_runner.WaitForElement(text='About')
89 class Top10PageSet(page_set_module.PageSet):
90 """10 Pages chosen from Alexa top sites"""
92 def __init__(self):
93 super(Top10PageSet, self).__init__(
94 archive_data_file='data/top_10.json',
95 user_agent_type='desktop',
96 bucket=page_set_module.PARTNER_BUCKET)
98 # top google property; a google tab is often open
99 self.AddPage(Google(self))
101 # productivity, top google properties
102 # TODO(dominikg): fix crbug.com/386152
103 #self.AddPage(Gmail(self))
105 # productivity, top google properties
106 self.AddPage(GoogleCalendar(self))
108 # #3 (Alexa global)
109 self.AddPage(Youtube(self))
111 # top social, Public profile
112 self.AddPage(Facebook(self))
114 # #6 (Alexa) most visited worldwide,Picked an interesting page
115 self.AddPage(SimpleScrollPage('http://en.wikipedia.org/wiki/Wikipedia',
116 self, name='Wikipedia'))
118 # #1 world commerce website by visits; #3 commerce in the US by time spent
119 self.AddPage(SimpleScrollPage('http://www.amazon.com', self))
121 # #4 Alexa
122 self.AddPage(SimpleScrollPage('http://www.yahoo.com/', self))
124 # #16 Alexa
125 self.AddPage(SimpleScrollPage('http://www.bing.com/', self))
127 # #20 Alexa
128 self.AddPage(SimpleScrollPage('http://www.ask.com/', self))