OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 from telemetry.page import page as page_module | 4 from telemetry.page import page as page_module |
5 from telemetry.page import page_set as page_set_module | 5 from telemetry.page import page_set as page_set_module |
6 | 6 |
7 | 7 |
8 class ToughPinchZoomCasesPage(page_module.Page): | 8 class ToughPinchZoomCasesPage(page_module.Page): |
9 | 9 |
10 def __init__(self, url, page_set, name=''): | 10 def __init__(self, url, page_set, name=''): |
11 super(ToughPinchZoomCasesPage, self).__init__( | 11 super(ToughPinchZoomCasesPage, self).__init__( |
12 url=url, page_set=page_set, name=name, | 12 url=url, page_set=page_set, name=name, |
13 credentials_path = 'data/credentials.json') | 13 credentials_path = 'data/credentials.json') |
14 self.user_agent_type = 'desktop' | 14 self.user_agent_type = 'desktop' |
15 self.archive_data_file = 'data/tough_pinch_zoom_cases.json' | 15 self.archive_data_file = 'data/tough_pinch_zoom_cases.json' |
16 | 16 |
17 def RunPageInteractions(self, action_runner): | 17 def RunPageInteractions(self, action_runner): |
18 interaction = action_runner.BeginGestureInteraction( | 18 with action_runner.CreateGestureInteraction('PinchAction'): |
19 'PinchAction') | 19 action_runner.PinchPage() |
20 action_runner.PinchPage() | |
21 interaction.End() | |
22 | 20 |
23 | 21 |
24 class GoogleSearchPage(ToughPinchZoomCasesPage): | 22 class GoogleSearchPage(ToughPinchZoomCasesPage): |
25 | 23 |
26 """ Why: top google property; a google tab is often open. """ | 24 """ Why: top google property; a google tab is often open. """ |
27 | 25 |
28 def __init__(self, page_set): | 26 def __init__(self, page_set): |
29 super(GoogleSearchPage, self).__init__( | 27 super(GoogleSearchPage, self).__init__( |
30 url='https://www.google.com/#hl=en&q=barack+obama', | 28 url='https://www.google.com/#hl=en&q=barack+obama', |
31 page_set=page_set) | 29 page_set=page_set) |
(...skipping 30 matching lines...) Expand all Loading... |
62 url='https://www.google.com/calendar/', | 60 url='https://www.google.com/calendar/', |
63 page_set=page_set) | 61 page_set=page_set) |
64 | 62 |
65 self.credentials = 'google' | 63 self.credentials = 'google' |
66 | 64 |
67 def RunNavigateSteps(self, action_runner): | 65 def RunNavigateSteps(self, action_runner): |
68 super(GoogleCalendarPage, self).RunNavigateSteps(action_runner) | 66 super(GoogleCalendarPage, self).RunNavigateSteps(action_runner) |
69 action_runner.Wait(2) | 67 action_runner.Wait(2) |
70 | 68 |
71 def RunPageInteractions(self, action_runner): | 69 def RunPageInteractions(self, action_runner): |
72 interaction = action_runner.BeginGestureInteraction( | 70 with action_runner.CreateGestureInteraction('PinchAction'): |
73 'PinchAction') | 71 action_runner.PinchPage(left_anchor_ratio=0.1, top_anchor_ratio=0.3) |
74 action_runner.PinchPage(left_anchor_ratio=0.1, top_anchor_ratio=0.3) | |
75 interaction.End() | |
76 | 72 |
77 | 73 |
78 class GoogleImageSearchPage(ToughPinchZoomCasesPage): | 74 class GoogleImageSearchPage(ToughPinchZoomCasesPage): |
79 | 75 |
80 """ Why: tough image case; top google properties """ | 76 """ Why: tough image case; top google properties """ |
81 | 77 |
82 def __init__(self, page_set): | 78 def __init__(self, page_set): |
83 super(GoogleImageSearchPage, self).__init__( | 79 super(GoogleImageSearchPage, self).__init__( |
84 url='https://www.google.com/search?q=cats&tbm=isch', | 80 url='https://www.google.com/search?q=cats&tbm=isch', |
85 page_set=page_set) | 81 page_set=page_set) |
(...skipping 10 matching lines...) Expand all Loading... |
96 url='https://plus.google.com/+BarackObama/posts', | 92 url='https://plus.google.com/+BarackObama/posts', |
97 page_set=page_set) | 93 page_set=page_set) |
98 | 94 |
99 self.credentials = 'google' | 95 self.credentials = 'google' |
100 | 96 |
101 def RunNavigateSteps(self, action_runner): | 97 def RunNavigateSteps(self, action_runner): |
102 super(GooglePlusPage, self).RunNavigateSteps(action_runner) | 98 super(GooglePlusPage, self).RunNavigateSteps(action_runner) |
103 action_runner.WaitForElement(text='Home') | 99 action_runner.WaitForElement(text='Home') |
104 | 100 |
105 def RunPageInteractions(self, action_runner): | 101 def RunPageInteractions(self, action_runner): |
106 interaction = action_runner.BeginGestureInteraction( | 102 with action_runner.CreateGestureInteraction('PinchAction'): |
107 'PinchAction') | 103 action_runner.PinchElement( |
108 action_runner.PinchElement(selector='[id="110031535020051778989-tab-bar"]') | 104 selector='[id="110031535020051778989-tab-bar"]') |
109 interaction.End() | |
110 | 105 |
111 | 106 |
112 class YoutubePage(ToughPinchZoomCasesPage): | 107 class YoutubePage(ToughPinchZoomCasesPage): |
113 | 108 |
114 """ Why: #3 (Alexa global) """ | 109 """ Why: #3 (Alexa global) """ |
115 | 110 |
116 def __init__(self, page_set): | 111 def __init__(self, page_set): |
117 super(YoutubePage, self).__init__( | 112 super(YoutubePage, self).__init__( |
118 url='http://www.youtube.com', | 113 url='http://www.youtube.com', |
119 page_set=page_set) | 114 page_set=page_set) |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 class YahooAnswersPage(ToughPinchZoomCasesPage): | 222 class YahooAnswersPage(ToughPinchZoomCasesPage): |
228 | 223 |
229 """ Why: #1 Alexa reference """ | 224 """ Why: #1 Alexa reference """ |
230 | 225 |
231 def __init__(self, page_set): | 226 def __init__(self, page_set): |
232 super(YahooAnswersPage, self).__init__( | 227 super(YahooAnswersPage, self).__init__( |
233 url='http://answers.yahoo.com', | 228 url='http://answers.yahoo.com', |
234 page_set=page_set) | 229 page_set=page_set) |
235 | 230 |
236 def RunPageInteractions(self, action_runner): | 231 def RunPageInteractions(self, action_runner): |
237 interaction = action_runner.BeginGestureInteraction( | 232 with action_runner.CreateGestureInteraction('PinchAction'): |
238 'PinchAction') | 233 action_runner.PinchElement(selector='#ya-content-apps') |
239 action_runner.PinchElement(selector='#ya-content-apps') | |
240 interaction.End() | |
241 | 234 |
242 | 235 |
243 class ToughPinchZoomCasesPageSet(page_set_module.PageSet): | 236 class ToughPinchZoomCasesPageSet(page_set_module.PageSet): |
244 | 237 |
245 """ Set of pages that are tricky to pinch-zoom """ | 238 """ Set of pages that are tricky to pinch-zoom """ |
246 | 239 |
247 def __init__(self): | 240 def __init__(self): |
248 super(ToughPinchZoomCasesPageSet, self).__init__( | 241 super(ToughPinchZoomCasesPageSet, self).__init__( |
249 user_agent_type='desktop', | 242 user_agent_type='desktop', |
250 archive_data_file='data/tough_pinch_zoom_cases.json', | 243 archive_data_file='data/tough_pinch_zoom_cases.json', |
(...skipping 29 matching lines...) Expand all Loading... |
280 | 273 |
281 self.AddUserStory(YahooGamePage(self)) | 274 self.AddUserStory(YahooGamePage(self)) |
282 | 275 |
283 # Why: #1 Alexa recreation | 276 # Why: #1 Alexa recreation |
284 self.AddUserStory(ToughPinchZoomCasesPage('http://booking.com', self)) | 277 self.AddUserStory(ToughPinchZoomCasesPage('http://booking.com', self)) |
285 | 278 |
286 self.AddUserStory(YahooAnswersPage(self)) | 279 self.AddUserStory(YahooAnswersPage(self)) |
287 | 280 |
288 # Why: #1 Alexa sports | 281 # Why: #1 Alexa sports |
289 self.AddUserStory(ToughPinchZoomCasesPage('http://sports.yahoo.com/', self)) | 282 self.AddUserStory(ToughPinchZoomCasesPage('http://sports.yahoo.com/', self)) |
OLD | NEW |