Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: tools/perf/page_sets/top_7_stress.py

Issue 2933173002: Deleting unused story sets (Closed)
Patch Set: Deleting unused story sets Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/perf/page_sets/top_25_smooth.py ('k') | tools/perf/page_sets/top_desktop_sites_2012Q3.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
9 def _GetCurrentLocation(action_runner):
10 return action_runner.EvaluateJavaScript('document.location.href')
11
12
13 def _WaitForLocationChange(action_runner, old_href):
14 action_runner.WaitForJavaScriptCondition(
15 'document.location.href != {{ old_href }}', old_href=old_href)
16
17
18 class Top7StressPage(page_module.Page):
19
20 def __init__(self, url, page_set, name=''):
21 super(Top7StressPage, self).__init__(
22 url=url, page_set=page_set, name=name,
23 shared_page_state_class=shared_page_state.SharedDesktopPageState,
24 credentials_path = 'data/credentials.json')
25 self.archive_data_file = 'data/top_7_stress.json'
26
27 def RunPageInteractions(self, action_runner):
28 raise NotImplementedError()
29
30
31 class GoogleWebSearchPage(Top7StressPage):
32
33 """ Why: top google property; a google tab is often open """
34
35 def __init__(self, page_set):
36 super(GoogleWebSearchPage, self).__init__(
37 url='https://www.google.com/#hl=en&q=barack+obama',
38 page_set=page_set)
39
40 def RunNavigateSteps(self, action_runner):
41 super(GoogleWebSearchPage, self).RunNavigateSteps(action_runner)
42 action_runner.WaitForElement(text='Next')
43
44 def RunPageInteractions(self, action_runner):
45 with action_runner.CreateGestureInteraction('ScrollAction'):
46 action_runner.ScrollPage()
47 old_href = _GetCurrentLocation(action_runner)
48 action_runner.ClickElement(text='Next')
49 _WaitForLocationChange(action_runner, old_href)
50 action_runner.WaitForElement(text='Next')
51 with action_runner.CreateGestureInteraction('ScrollAction'):
52 action_runner.ScrollPage()
53 old_href = _GetCurrentLocation(action_runner)
54 action_runner.ClickElement(text='Next')
55 _WaitForLocationChange(action_runner, old_href)
56 action_runner.WaitForElement(text='Next')
57 with action_runner.CreateGestureInteraction('ScrollAction'):
58 action_runner.ScrollPage()
59 old_href = _GetCurrentLocation(action_runner)
60 action_runner.ClickElement(text='Next')
61 _WaitForLocationChange(action_runner, old_href)
62 action_runner.WaitForElement(text='Previous')
63 with action_runner.CreateGestureInteraction('ScrollAction'):
64 action_runner.ScrollPage()
65 old_href = _GetCurrentLocation(action_runner)
66 action_runner.ClickElement(text='Previous')
67 _WaitForLocationChange(action_runner, old_href)
68 action_runner.WaitForElement(text='Previous')
69 with action_runner.CreateGestureInteraction('ScrollAction'):
70 action_runner.ScrollPage()
71 old_href = _GetCurrentLocation(action_runner)
72 action_runner.ClickElement(text='Previous')
73 _WaitForLocationChange(action_runner, old_href)
74 action_runner.WaitForElement(text='Previous')
75 with action_runner.CreateGestureInteraction('ScrollAction'):
76 action_runner.ScrollPage()
77 old_href = _GetCurrentLocation(action_runner)
78 action_runner.ClickElement(text='Previous')
79 _WaitForLocationChange(action_runner, old_href)
80 action_runner.WaitForElement(text='Images')
81 with action_runner.CreateGestureInteraction('ScrollAction'):
82 action_runner.ScrollPage()
83 old_href = _GetCurrentLocation(action_runner)
84 action_runner.ClickElement(text='Images')
85 _WaitForLocationChange(action_runner, old_href)
86 action_runner.WaitForElement(text='Images')
87
88
89 class GmailPage(Top7StressPage):
90
91 """ Why: productivity, top google properties """
92
93 def __init__(self, page_set):
94 super(GmailPage, self).__init__(
95 url='https://mail.google.com/mail/',
96 page_set=page_set)
97
98 self.credentials = 'google'
99
100 def RunNavigateSteps(self, action_runner):
101 super(GmailPage, self).RunNavigateSteps(action_runner)
102 action_runner.WaitForJavaScriptCondition(
103 'window.gmonkey !== undefined &&'
104 'document.getElementById("gb") !== null')
105
106 def RunPageInteractions(self, action_runner):
107 old_href = _GetCurrentLocation(action_runner)
108 action_runner.ClickElement(
109 'a[href="https://mail.google.com/mail/u/0/?shva=1#starred"]')
110 _WaitForLocationChange(action_runner, old_href)
111 old_href = _GetCurrentLocation(action_runner)
112 action_runner.ClickElement(
113 'a[href="https://mail.google.com/mail/u/0/?shva=1#inbox"]')
114 _WaitForLocationChange(action_runner, old_href)
115
116
117 class GoogleCalendarPage(Top7StressPage):
118
119 """ Why: productivity, top google properties """
120
121 def __init__(self, page_set):
122 super(GoogleCalendarPage, self).__init__(
123 url='https://www.google.com/calendar/',
124 page_set=page_set)
125
126 self.credentials = 'google'
127
128 def RunNavigateSteps(self, action_runner):
129 super(GoogleCalendarPage, self).RunNavigateSteps(action_runner)
130 action_runner.Wait(2)
131 action_runner.WaitForElement('div[class~="navForward"]')
132 action_runner.ExecuteJavaScript('''
133 (function() {
134 var elem = document.createElement('meta');
135 elem.name='viewport';
136 elem.content='initial-scale=1';
137 document.body.appendChild(elem);
138 })();''')
139 action_runner.Wait(1)
140
141 def RunPageInteractions(self, action_runner):
142 action_runner.ClickElement('div[class~="navForward"]')
143 action_runner.Wait(2)
144 action_runner.WaitForElement('div[class~="navForward"]')
145 action_runner.ClickElement('div[class~="navForward"]')
146 action_runner.Wait(2)
147 action_runner.WaitForElement('div[class~="navForward"]')
148 action_runner.ClickElement('div[class~="navForward"]')
149 action_runner.Wait(2)
150 action_runner.WaitForElement('div[class~="navForward"]')
151 action_runner.ClickElement('div[class~="navForward"]')
152 action_runner.Wait(2)
153 action_runner.WaitForElement('div[class~="navBack"]')
154 action_runner.ClickElement('div[class~="navBack"]')
155 action_runner.Wait(2)
156 action_runner.WaitForElement('div[class~="navBack"]')
157 action_runner.ClickElement('div[class~="navBack"]')
158 action_runner.Wait(2)
159 action_runner.WaitForElement('div[class~="navBack"]')
160 action_runner.ClickElement('div[class~="navBack"]')
161 action_runner.Wait(2)
162 action_runner.WaitForElement('div[class~="navBack"]')
163 action_runner.ClickElement('div[class~="navBack"]')
164 action_runner.Wait(2)
165 action_runner.WaitForElement('div[class~="navBack"]')
166
167
168 class GooglePlusPage(Top7StressPage):
169
170 """ Why: social; top google property; Public profile; infinite scrolls """
171
172 def __init__(self, page_set):
173 super(GooglePlusPage, self).__init__(
174 url='https://plus.google.com/110031535020051778989/posts',
175 page_set=page_set)
176
177 self.credentials = 'google'
178
179 def RunNavigateSteps(self, action_runner):
180 super(GooglePlusPage, self).RunNavigateSteps(action_runner)
181 action_runner.WaitForElement(text='Home')
182
183 def RunPageInteractions(self, action_runner):
184 action_runner.ClickElement(text='Home')
185 action_runner.Wait(2)
186 action_runner.WaitForElement(text='Profile')
187 action_runner.ClickElement(text='Profile')
188 action_runner.Wait(2)
189 action_runner.WaitForElement(text='Explore')
190 action_runner.ClickElement(text='Explore')
191 action_runner.Wait(2)
192 action_runner.WaitForElement(text='Events')
193 action_runner.ClickElement(text='Events')
194 action_runner.Wait(2)
195 action_runner.WaitForElement(text='Communities')
196 action_runner.ClickElement(text='Communities')
197 action_runner.Wait(2)
198 action_runner.WaitForElement(text='Home')
199
200
201 class BlogspotPage(Top7StressPage):
202
203 """ Why: #11 (Alexa global), google property; some blogger layouts have
204 infinite scroll but more interesting """
205
206 def __init__(self, page_set):
207 super(BlogspotPage, self).__init__(
208 url='http://googlewebmastercentral.blogspot.com/',
209 page_set=page_set,
210 name='Blogger')
211
212 def RunNavigateSteps(self, action_runner):
213 super(BlogspotPage, self).RunNavigateSteps(action_runner)
214 action_runner.WaitForElement(text='accessibility')
215
216 def RunPageInteractions(self, action_runner):
217 action_runner.ClickElement(text='accessibility')
218 action_runner.WaitForNavigate()
219 with action_runner.CreateGestureInteraction('ScrollAction'):
220 action_runner.ScrollPage()
221 # Insert 300ms wait to simulate user finger movement,
222 # and ensure scheduling of idle tasks.
223 action_runner.Wait(0.3)
224 action_runner.ClickElement(text='advanced')
225 action_runner.WaitForNavigate()
226 with action_runner.CreateGestureInteraction('ScrollAction'):
227 action_runner.ScrollPage()
228 action_runner.Wait(0.3)
229 action_runner.ClickElement(text='beginner')
230 action_runner.WaitForNavigate()
231 with action_runner.CreateGestureInteraction('ScrollAction'):
232 action_runner.ScrollPage()
233 action_runner.Wait(0.3)
234 action_runner.ClickElement(text='Home')
235 action_runner.WaitForNavigate()
236
237
238 class WordpressPage(Top7StressPage):
239
240 """ Why: #18 (Alexa global), Picked an interesting post """
241
242 def __init__(self, page_set):
243 super(WordpressPage, self).__init__(
244 # pylint: disable=line-too-long
245 url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks -for-august-2012/',
246 page_set=page_set,
247 name='Wordpress')
248
249 def RunNavigateSteps(self, action_runner):
250 super(WordpressPage, self).RunNavigateSteps(action_runner)
251 action_runner.WaitForElement(
252 # pylint: disable=line-too-long
253 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sig ht/"]')
254
255 def RunPageInteractions(self, action_runner):
256 with action_runner.CreateGestureInteraction('ScrollAction'):
257 action_runner.ScrollPage()
258 # Insert 300ms wait to simulate user finger movement,
259 # and ensure scheduling of idle tasks.
260 action_runner.Wait(0.3)
261 action_runner.ClickElement(
262 # pylint: disable=line-too-long
263 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sig ht/"]')
264 action_runner.WaitForNavigate()
265 with action_runner.CreateGestureInteraction('ScrollAction'):
266 action_runner.ScrollPage()
267 action_runner.Wait(0.3)
268 action_runner.ClickElement(text='Features')
269 action_runner.WaitForNavigate()
270 with action_runner.CreateGestureInteraction('ScrollAction'):
271 action_runner.ScrollPage()
272 action_runner.Wait(0.3)
273 action_runner.ClickElement(text='News')
274 action_runner.WaitForNavigate()
275 with action_runner.CreateGestureInteraction('ScrollAction'):
276 action_runner.ScrollPage()
277
278
279 class FacebookPage(Top7StressPage):
280
281 """ Why: top social,Public profile """
282
283 def __init__(self, page_set):
284 super(FacebookPage, self).__init__(
285 url='https://www.facebook.com/barackobama',
286 page_set=page_set,
287 name='Facebook')
288 self.credentials = 'facebook2'
289
290 def RunNavigateSteps(self, action_runner):
291 super(FacebookPage, self).RunNavigateSteps(action_runner)
292 action_runner.WaitForElement(text='About')
293
294 def RunPageInteractions(self, action_runner):
295 # Scroll and wait for the next page to be loaded.
296 with action_runner.CreateGestureInteraction('ScrollAction'):
297 action_runner.ScrollPage()
298 action_runner.WaitForJavaScriptCondition(
299 'document.documentElement.scrollHeight - window.innerHeight - '
300 'window.pageYOffset > 0')
301
302 # Scroll and wait again.
303 with action_runner.CreateGestureInteraction('ScrollAction'):
304 action_runner.ScrollPage()
305 action_runner.WaitForJavaScriptCondition(
306 'document.documentElement.scrollHeight - window.innerHeight - '
307 'window.pageYOffset > 0')
308
309 class Top7StressPageSet(story.StorySet):
310
311 """ Pages hand-picked for stress testing. """
312
313 def __init__(self):
314 super(Top7StressPageSet, self).__init__(
315 archive_data_file='data/top_7_stress.json',
316 cloud_storage_bucket=story.PARTNER_BUCKET)
317
318 self.AddStory(GoogleWebSearchPage(self))
319 self.AddStory(GmailPage(self))
320 self.AddStory(GoogleCalendarPage(self))
321 self.AddStory(GooglePlusPage(self))
322 self.AddStory(BlogspotPage(self))
323 self.AddStory(WordpressPage(self))
324 self.AddStory(FacebookPage(self))
OLDNEW
« no previous file with comments | « tools/perf/page_sets/top_25_smooth.py ('k') | tools/perf/page_sets/top_desktop_sites_2012Q3.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698