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 interaction = action_runner.BeginGestureInteraction( |
19 'PinchAction', is_smooth=True) | 19 'PinchAction') |
20 action_runner.PinchPage() | 20 action_runner.PinchPage() |
21 interaction.End() | 21 interaction.End() |
22 | 22 |
23 | 23 |
24 class GoogleSearchPage(ToughPinchZoomCasesPage): | 24 class GoogleSearchPage(ToughPinchZoomCasesPage): |
25 | 25 |
26 """ Why: top google property; a google tab is often open. """ | 26 """ Why: top google property; a google tab is often open. """ |
27 | 27 |
28 def __init__(self, page_set): | 28 def __init__(self, page_set): |
29 super(GoogleSearchPage, self).__init__( | 29 super(GoogleSearchPage, self).__init__( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 page_set=page_set) | 63 page_set=page_set) |
64 | 64 |
65 self.credentials = 'google' | 65 self.credentials = 'google' |
66 | 66 |
67 def RunNavigateSteps(self, action_runner): | 67 def RunNavigateSteps(self, action_runner): |
68 super(GoogleCalendarPage, self).RunNavigateSteps(action_runner) | 68 super(GoogleCalendarPage, self).RunNavigateSteps(action_runner) |
69 action_runner.Wait(2) | 69 action_runner.Wait(2) |
70 | 70 |
71 def RunPageInteractions(self, action_runner): | 71 def RunPageInteractions(self, action_runner): |
72 interaction = action_runner.BeginGestureInteraction( | 72 interaction = action_runner.BeginGestureInteraction( |
73 'PinchAction', is_smooth=True) | 73 'PinchAction') |
74 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() | 75 interaction.End() |
76 | 76 |
77 | 77 |
78 class GoogleImageSearchPage(ToughPinchZoomCasesPage): | 78 class GoogleImageSearchPage(ToughPinchZoomCasesPage): |
79 | 79 |
80 """ Why: tough image case; top google properties """ | 80 """ Why: tough image case; top google properties """ |
81 | 81 |
82 def __init__(self, page_set): | 82 def __init__(self, page_set): |
83 super(GoogleImageSearchPage, self).__init__( | 83 super(GoogleImageSearchPage, self).__init__( |
(...skipping 13 matching lines...) Expand all Loading... |
97 page_set=page_set) | 97 page_set=page_set) |
98 | 98 |
99 self.credentials = 'google' | 99 self.credentials = 'google' |
100 | 100 |
101 def RunNavigateSteps(self, action_runner): | 101 def RunNavigateSteps(self, action_runner): |
102 super(GooglePlusPage, self).RunNavigateSteps(action_runner) | 102 super(GooglePlusPage, self).RunNavigateSteps(action_runner) |
103 action_runner.WaitForElement(text='Home') | 103 action_runner.WaitForElement(text='Home') |
104 | 104 |
105 def RunPageInteractions(self, action_runner): | 105 def RunPageInteractions(self, action_runner): |
106 interaction = action_runner.BeginGestureInteraction( | 106 interaction = action_runner.BeginGestureInteraction( |
107 'PinchAction', is_smooth=True) | 107 'PinchAction') |
108 action_runner.PinchElement(selector='[id="110031535020051778989-tab-bar"]') | 108 action_runner.PinchElement(selector='[id="110031535020051778989-tab-bar"]') |
109 interaction.End() | 109 interaction.End() |
110 | 110 |
111 | 111 |
112 class YoutubePage(ToughPinchZoomCasesPage): | 112 class YoutubePage(ToughPinchZoomCasesPage): |
113 | 113 |
114 """ Why: #3 (Alexa global) """ | 114 """ Why: #3 (Alexa global) """ |
115 | 115 |
116 def __init__(self, page_set): | 116 def __init__(self, page_set): |
117 super(YoutubePage, self).__init__( | 117 super(YoutubePage, self).__init__( |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 228 |
229 """ Why: #1 Alexa reference """ | 229 """ Why: #1 Alexa reference """ |
230 | 230 |
231 def __init__(self, page_set): | 231 def __init__(self, page_set): |
232 super(YahooAnswersPage, self).__init__( | 232 super(YahooAnswersPage, self).__init__( |
233 url='http://answers.yahoo.com', | 233 url='http://answers.yahoo.com', |
234 page_set=page_set) | 234 page_set=page_set) |
235 | 235 |
236 def RunPageInteractions(self, action_runner): | 236 def RunPageInteractions(self, action_runner): |
237 interaction = action_runner.BeginGestureInteraction( | 237 interaction = action_runner.BeginGestureInteraction( |
238 'PinchAction', is_smooth=True) | 238 'PinchAction') |
239 action_runner.PinchElement(selector='#ya-content-apps') | 239 action_runner.PinchElement(selector='#ya-content-apps') |
240 interaction.End() | 240 interaction.End() |
241 | 241 |
242 | 242 |
243 class ToughPinchZoomCasesPageSet(page_set_module.PageSet): | 243 class ToughPinchZoomCasesPageSet(page_set_module.PageSet): |
244 | 244 |
245 """ Set of pages that are tricky to pinch-zoom """ | 245 """ Set of pages that are tricky to pinch-zoom """ |
246 | 246 |
247 def __init__(self): | 247 def __init__(self): |
248 super(ToughPinchZoomCasesPageSet, self).__init__( | 248 super(ToughPinchZoomCasesPageSet, self).__init__( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 280 |
281 self.AddUserStory(YahooGamePage(self)) | 281 self.AddUserStory(YahooGamePage(self)) |
282 | 282 |
283 # Why: #1 Alexa recreation | 283 # Why: #1 Alexa recreation |
284 self.AddUserStory(ToughPinchZoomCasesPage('http://booking.com', self)) | 284 self.AddUserStory(ToughPinchZoomCasesPage('http://booking.com', self)) |
285 | 285 |
286 self.AddUserStory(YahooAnswersPage(self)) | 286 self.AddUserStory(YahooAnswersPage(self)) |
287 | 287 |
288 # Why: #1 Alexa sports | 288 # Why: #1 Alexa sports |
289 self.AddUserStory(ToughPinchZoomCasesPage('http://sports.yahoo.com/', self)) | 289 self.AddUserStory(ToughPinchZoomCasesPage('http://sports.yahoo.com/', self)) |
OLD | NEW |