[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / tools / perf / page_sets / top_10.py
blobbd57bd88e2910bdd4134cbf851a07cc04bf72426
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
9 class SimplePage(page_module.Page):
10 def __init__(self, url, page_set, credentials='', name=''):
11 super(SimplePage, self).__init__(
12 url, page_set=page_set, name=name,
13 credentials_path='data/credentials.json',
14 shared_page_state_class=shared_page_state.SharedDesktopPageState)
15 self.credentials = credentials
17 def RunPageInteractions(self, action_runner):
18 pass
21 class Google(SimplePage):
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(SimplePage):
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(SimplePage):
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(SimplePage):
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(SimplePage):
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(story.StorySet):
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 cloud_storage_bucket=story.PARTNER_BUCKET)
97 # top google property; a google tab is often open
98 self.AddStory(Google(self))
100 # productivity, top google properties
101 # TODO(dominikg): fix crbug.com/386152
102 #self.AddStory(Gmail(self))
104 # productivity, top google properties
105 self.AddStory(GoogleCalendar(self))
107 # #3 (Alexa global)
108 self.AddStory(Youtube(self))
110 # top social, Public profile
111 self.AddStory(Facebook(self))
113 # #6 (Alexa) most visited worldwide,Picked an interesting page
114 self.AddStory(SimplePage('http://en.wikipedia.org/wiki/Wikipedia',
115 self, name='Wikipedia'))
117 # #1 world commerce website by visits; #3 commerce in the US by time spent
118 self.AddStory(SimplePage('http://www.amazon.com', self))
120 # #4 Alexa
121 self.AddStory(SimplePage('http://www.yahoo.com/', self))
123 # #16 Alexa
124 self.AddStory(SimplePage('http://www.bing.com/', self))
126 # #20 Alexa
127 self.AddStory(SimplePage('http://www.ask.com/', self))