[Android WebViewShell] Add inclusion test for webview exposed stable interfaces.
[chromium-blink-merge.git] / tools / perf / page_sets / tough_pinch_zoom_cases.py
blobe81557e59ada98237cddf32dcbc0c9e7d86b12e4
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 ToughPinchZoomCasesPage(page_module.Page):
11 def __init__(self, url, page_set, name=''):
12 super(ToughPinchZoomCasesPage, self).__init__(
13 url=url, page_set=page_set, name=name,
14 shared_page_state_class=shared_page_state.SharedDesktopPageState,
15 credentials_path = 'data/credentials.json')
16 self.archive_data_file = 'data/tough_pinch_zoom_cases.json'
18 def RunPageInteractions(self, action_runner):
19 with action_runner.CreateGestureInteraction('PinchAction'):
20 action_runner.PinchPage()
23 class GoogleSearchPage(ToughPinchZoomCasesPage):
25 """ Why: top google property; a google tab is often open. """
27 def __init__(self, page_set):
28 super(GoogleSearchPage, self).__init__(
29 url='https://www.google.com/#hl=en&q=barack+obama',
30 page_set=page_set)
32 def RunNavigateSteps(self, action_runner):
33 super(GoogleSearchPage, self).RunNavigateSteps(action_runner)
34 action_runner.WaitForElement(text='Next')
37 class GmailPage(ToughPinchZoomCasesPage):
39 """ Why: productivity, top google properties """
41 def __init__(self, page_set):
42 super(GmailPage, self).__init__(
43 url='https://mail.google.com/mail/',
44 page_set=page_set)
46 self.credentials = 'google'
48 def RunNavigateSteps(self, action_runner):
49 super(GmailPage, self).RunNavigateSteps(action_runner)
50 action_runner.WaitForJavaScriptCondition(
51 'window.gmonkey !== undefined &&'
52 'document.getElementById("gb") !== null')
55 class GoogleCalendarPage(ToughPinchZoomCasesPage):
57 """ Why: productivity, top google properties """
59 def __init__(self, page_set):
60 super(GoogleCalendarPage, self).__init__(
61 url='https://www.google.com/calendar/',
62 page_set=page_set)
64 self.credentials = 'google'
66 def RunNavigateSteps(self, action_runner):
67 super(GoogleCalendarPage, self).RunNavigateSteps(action_runner)
68 action_runner.Wait(2)
70 def RunPageInteractions(self, action_runner):
71 with action_runner.CreateGestureInteraction('PinchAction'):
72 action_runner.PinchPage(left_anchor_ratio=0.1, top_anchor_ratio=0.3)
75 class GoogleImageSearchPage(ToughPinchZoomCasesPage):
77 """ Why: tough image case; top google properties """
79 def __init__(self, page_set):
80 super(GoogleImageSearchPage, self).__init__(
81 url='https://www.google.com/search?q=cats&tbm=isch',
82 page_set=page_set)
84 self.credentials = 'google'
87 class GooglePlusPage(ToughPinchZoomCasesPage):
89 """ Why: social; top google property; Public profile; infinite scrolls """
91 def __init__(self, page_set):
92 super(GooglePlusPage, self).__init__(
93 url='https://plus.google.com/+BarackObama/posts',
94 page_set=page_set)
96 self.credentials = 'google'
98 def RunNavigateSteps(self, action_runner):
99 super(GooglePlusPage, self).RunNavigateSteps(action_runner)
100 action_runner.WaitForElement(text='Home')
102 def RunPageInteractions(self, action_runner):
103 with action_runner.CreateGestureInteraction('PinchAction'):
104 action_runner.PinchElement(
105 selector='[id="110031535020051778989-tab-bar"]')
108 class YoutubePage(ToughPinchZoomCasesPage):
110 """ Why: #3 (Alexa global) """
112 def __init__(self, page_set):
113 super(YoutubePage, self).__init__(
114 url='http://www.youtube.com',
115 page_set=page_set)
117 self.credentials = 'google'
119 def RunNavigateSteps(self, action_runner):
120 super(YoutubePage, self).RunNavigateSteps(action_runner)
121 action_runner.Wait(2)
123 class BlogSpotPage(ToughPinchZoomCasesPage):
126 Why: #11 (Alexa global), google property; some blogger layouts have infinite
127 scroll but more interesting
130 def __init__(self, page_set):
131 super(BlogSpotPage, self).__init__(
132 url='http://googlewebmastercentral.blogspot.com/',
133 page_set=page_set, name='Blogger')
135 def RunNavigateSteps(self, action_runner):
136 super(BlogSpotPage, self).RunNavigateSteps(action_runner)
137 action_runner.WaitForElement(text='accessibility')
140 class FacebookPage(ToughPinchZoomCasesPage):
142 """ Why: top social,Public profile """
144 def __init__(self, page_set):
145 super(FacebookPage, self).__init__(
146 url='http://www.facebook.com/barackobama',
147 page_set=page_set, name='Facebook')
148 self.credentials = 'facebook'
150 def RunNavigateSteps(self, action_runner):
151 super(FacebookPage, self).RunNavigateSteps(action_runner)
152 action_runner.WaitForElement(text='About')
155 class LinkedinPage(ToughPinchZoomCasesPage):
157 """ Why: #12 (Alexa global),Public profile """
159 def __init__(self, page_set):
160 super(LinkedinPage, self).__init__(
161 url='http://www.linkedin.com/in/linustorvalds',
162 page_set=page_set, name='LinkedIn')
165 class WikipediaPage(ToughPinchZoomCasesPage):
167 """ Why: #6 (Alexa) most visited worldwide,Picked an interesting page """
169 def __init__(self, page_set):
170 super(WikipediaPage, self).__init__(
171 url='http://en.wikipedia.org/wiki/Wikipedia',
172 page_set=page_set, name='Wikipedia (1 tab)')
175 class TwitterPage(ToughPinchZoomCasesPage):
177 """ Why: #8 (Alexa global),Picked an interesting page """
179 def __init__(self, page_set):
180 super(TwitterPage, self).__init__(
181 url='https://twitter.com/katyperry',
182 page_set=page_set, name='Twitter')
184 def RunNavigateSteps(self, action_runner):
185 super(TwitterPage, self).RunNavigateSteps(action_runner)
186 action_runner.Wait(2)
188 class ESPNPage(ToughPinchZoomCasesPage):
190 """ Why: #1 sports """
192 def __init__(self, page_set):
193 super(ESPNPage, self).__init__(
194 url='http://espn.go.com/nba',
195 page_set=page_set, name='ESPN')
198 class WeatherDotComPage(ToughPinchZoomCasesPage):
200 """ Why: #7 (Alexa news); #27 total time spent,Picked interesting page """
202 def __init__(self, page_set):
203 super(WeatherDotComPage, self).__init__(
204 # pylint: disable=C0301
205 url='http://www.weather.com/weather/right-now/Mountain+View+CA+94043',
206 page_set=page_set, name='Weather.com')
209 class YahooGamePage(ToughPinchZoomCasesPage):
211 """ Why: #1 games according to Alexa (with actual games in it) """
213 def __init__(self, page_set):
214 super(YahooGamePage, self).__init__(
215 url='http://games.yahoo.com',
216 page_set=page_set)
218 def RunNavigateSteps(self, action_runner):
219 super(YahooGamePage, self).RunNavigateSteps(action_runner)
220 action_runner.Wait(2)
223 class YahooAnswersPage(ToughPinchZoomCasesPage):
225 """ Why: #1 Alexa reference """
227 def __init__(self, page_set):
228 super(YahooAnswersPage, self).__init__(
229 url='http://answers.yahoo.com',
230 page_set=page_set)
232 def RunPageInteractions(self, action_runner):
233 with action_runner.CreateGestureInteraction('PinchAction'):
234 action_runner.PinchElement(selector='#ya-content-apps')
237 class ToughPinchZoomCasesPageSet(story.StorySet):
239 """ Set of pages that are tricky to pinch-zoom """
241 def __init__(self):
242 super(ToughPinchZoomCasesPageSet, self).__init__(
243 archive_data_file='data/tough_pinch_zoom_cases.json',
244 cloud_storage_bucket=story.PARTNER_BUCKET)
246 self.AddStory(GoogleSearchPage(self))
247 self.AddStory(GmailPage(self))
248 self.AddStory(GoogleCalendarPage(self))
249 self.AddStory(GoogleImageSearchPage(self))
250 self.AddStory(GooglePlusPage(self))
251 self.AddStory(YoutubePage(self))
252 self.AddStory(BlogSpotPage(self))
253 self.AddStory(FacebookPage(self))
254 self.AddStory(LinkedinPage(self))
255 self.AddStory(WikipediaPage(self))
256 self.AddStory(TwitterPage(self))
257 self.AddStory(ESPNPage(self))
259 # Why: #1 news worldwide (Alexa global)
260 self.AddStory(ToughPinchZoomCasesPage('http://news.yahoo.com', self))
262 # Why: #2 news worldwide
263 self.AddStory(ToughPinchZoomCasesPage('http://www.cnn.com', self))
265 self.AddStory(WeatherDotComPage(self))
267 # Why: #1 world commerce website by visits; #3 commerce in the US by time
268 # spent
269 self.AddStory(ToughPinchZoomCasesPage('http://www.amazon.com', self))
271 # Why: #1 commerce website by time spent by users in US
272 self.AddStory(ToughPinchZoomCasesPage('http://www.ebay.com', self))
274 self.AddStory(YahooGamePage(self))
276 # Why: #1 Alexa recreation
277 self.AddStory(ToughPinchZoomCasesPage('http://booking.com', self))
279 self.AddStory(YahooAnswersPage(self))
281 # Why: #1 Alexa sports
282 self.AddStory(ToughPinchZoomCasesPage('http://sports.yahoo.com/', self))