[Session restore] Rename group name Enabled to Restore.
[chromium-blink-merge.git] / tools / perf / page_sets / top_10.py
blobe198ded038e5e639964ee14bbb8ed13217ed7e13
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 SimplePage(page_module.Page):
9 def __init__(self, url, page_set, credentials='', name=''):
10 super(SimplePage, self).__init__(
11 url, page_set=page_set, name=name,
12 credentials_path='data/credentials.json')
13 self.credentials = credentials
15 def RunPageInteractions(self, action_runner):
16 pass
18 class Google(SimplePage):
19 def __init__(self, page_set):
20 super(Google, self).__init__(
21 url='https://www.google.com/#hl=en&q=barack+obama', page_set=page_set)
23 def RunNavigateSteps(self, action_runner):
24 super(Google, self).RunNavigateSteps(action_runner)
25 action_runner.WaitForElement(text='Next')
28 class Gmail(SimplePage):
29 def __init__(self, page_set):
30 super(Gmail, self).__init__(
31 url='https://mail.google.com/mail/',
32 page_set=page_set,
33 credentials='google')
35 def RunNavigateSteps(self, action_runner):
36 super(Gmail, self).RunNavigateSteps(action_runner)
37 action_runner.WaitForJavaScriptCondition(
38 'window.gmonkey !== undefined &&'
39 'document.getElementById("gb") !== null')
42 class GoogleCalendar(SimplePage):
43 def __init__(self, page_set):
44 super(GoogleCalendar, self).__init__(
45 url='https://www.google.com/calendar/',
46 page_set=page_set,
47 credentials='google')
49 def RunNavigateSteps(self, action_runner):
50 super(GoogleCalendar, self).RunNavigateSteps(action_runner)
51 action_runner.ExecuteJavaScript('''
52 (function() { var elem = document.createElement("meta");
53 elem.name="viewport";
54 elem.content="initial-scale=1";
55 document.body.appendChild(elem);
56 })();''')
57 action_runner.Wait(2)
58 action_runner.WaitForElement('div[class~="navForward"]')
61 class Youtube(SimplePage):
62 def __init__(self, page_set):
63 super(Youtube, self).__init__(
64 url='http://www.youtube.com',
65 page_set=page_set,
66 credentials='google')
68 def RunNavigateSteps(self, action_runner):
69 super(Youtube, self).RunNavigateSteps(action_runner)
70 action_runner.Wait(2)
73 class Facebook(SimplePage):
74 def __init__(self, page_set):
75 super(Facebook, self).__init__(
76 url='http://www.facebook.com/barackobama',
77 page_set=page_set,
78 credentials='facebook',
79 name='Facebook')
81 def RunNavigateSteps(self, action_runner):
82 super(Facebook, self).RunNavigateSteps(action_runner)
83 action_runner.WaitForElement(text='About')
86 class Top10PageSet(page_set_module.PageSet):
87 """10 Pages chosen from Alexa top sites"""
89 def __init__(self):
90 super(Top10PageSet, self).__init__(
91 archive_data_file='data/top_10.json',
92 user_agent_type='desktop',
93 bucket=page_set_module.PARTNER_BUCKET)
95 # top google property; a google tab is often open
96 self.AddUserStory(Google(self))
98 # productivity, top google properties
99 # TODO(dominikg): fix crbug.com/386152
100 #self.AddUserStory(Gmail(self))
102 # productivity, top google properties
103 self.AddUserStory(GoogleCalendar(self))
105 # #3 (Alexa global)
106 self.AddUserStory(Youtube(self))
108 # top social, Public profile
109 self.AddUserStory(Facebook(self))
111 # #6 (Alexa) most visited worldwide,Picked an interesting page
112 self.AddUserStory(SimplePage('http://en.wikipedia.org/wiki/Wikipedia',
113 self, name='Wikipedia'))
115 # #1 world commerce website by visits; #3 commerce in the US by time spent
116 self.AddUserStory(SimplePage('http://www.amazon.com', self))
118 # #4 Alexa
119 self.AddUserStory(SimplePage('http://www.yahoo.com/', self))
121 # #16 Alexa
122 self.AddUserStory(SimplePage('http://www.bing.com/', self))
124 # #20 Alexa
125 self.AddUserStory(SimplePage('http://www.ask.com/', self))