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 # pylint: disable=W0401,W0614 | 4 # pylint: disable=W0401,W0614 |
5 from telemetry.page.actions.all_page_actions import * | 5 from telemetry.page.actions.all_page_actions import * |
6 from telemetry.page import page as page_module | 6 from telemetry.page import page as page_module |
7 from telemetry.page import page_set as page_set_module | 7 from telemetry.page import page_set as page_set_module |
8 | 8 |
9 | 9 |
10 class ToughPinchZoomCasesPage(page_module.Page): | 10 class ToughPinchZoomCasesPage(page_module.Page): |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 self.credentials = 'google' | 71 self.credentials = 'google' |
72 | 72 |
73 def RunNavigateSteps(self, action_runner): | 73 def RunNavigateSteps(self, action_runner): |
74 action_runner.RunAction(NavigateAction()) | 74 action_runner.RunAction(NavigateAction()) |
75 action_runner.RunAction(WaitAction({'seconds':2})) | 75 action_runner.RunAction(WaitAction({'seconds':2})) |
76 | 76 |
77 def RunSmoothness(self, action_runner): | 77 def RunSmoothness(self, action_runner): |
78 action_runner.RunAction(PinchAction( | 78 action_runner.RunAction(PinchAction( |
79 { | 79 { |
80 'left_anchor_percentage': 0.1, | 80 'left_anchor_percentage': 0.1, |
81 'top_anchor_percentage': 0.1 | 81 'top_anchor_percentage': 0.3 |
82 })) | 82 })) |
83 | 83 |
84 | 84 |
85 class GoogleImageSearchPage(ToughPinchZoomCasesPage): | 85 class GoogleImageSearchPage(ToughPinchZoomCasesPage): |
86 | 86 |
87 """ Why: tough image case; top google properties """ | 87 """ Why: tough image case; top google properties """ |
88 | 88 |
89 def __init__(self, page_set): | 89 def __init__(self, page_set): |
90 super(GoogleImageSearchPage, self).__init__( | 90 super(GoogleImageSearchPage, self).__init__( |
91 url='https://www.google.com/search?q=cats&tbm=isch', | 91 url='https://www.google.com/search?q=cats&tbm=isch', |
(...skipping 19 matching lines...) Expand all Loading... |
111 { | 111 { |
112 'text': 'Home', | 112 'text': 'Home', |
113 'condition': 'element' | 113 'condition': 'element' |
114 })) | 114 })) |
115 | 115 |
116 def RunSmoothness(self, action_runner): | 116 def RunSmoothness(self, action_runner): |
117 action_runner.RunAction(PinchAction( | 117 action_runner.RunAction(PinchAction( |
118 { | 118 { |
119 'element_function': ''' | 119 'element_function': ''' |
120 function(callback) { | 120 function(callback) { |
121 callback(document.getElementsByClassName("Ct")[0]) | 121 callback(document.getElementById("110031535020051778989-tab-bar")) |
122 }''' | 122 }''' |
123 })) | 123 })) |
124 | 124 |
125 | 125 |
126 class YoutubePage(ToughPinchZoomCasesPage): | 126 class YoutubePage(ToughPinchZoomCasesPage): |
127 | 127 |
128 """ Why: #3 (Alexa global) """ | 128 """ Why: #3 (Alexa global) """ |
129 | 129 |
130 def __init__(self, page_set): | 130 def __init__(self, page_set): |
131 super(YoutubePage, self).__init__( | 131 super(YoutubePage, self).__init__( |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 def __init__(self, page_set): | 239 def __init__(self, page_set): |
240 super(YahooGamePage, self).__init__( | 240 super(YahooGamePage, self).__init__( |
241 url='http://games.yahoo.com', | 241 url='http://games.yahoo.com', |
242 page_set=page_set) | 242 page_set=page_set) |
243 | 243 |
244 def RunNavigateSteps(self, action_runner): | 244 def RunNavigateSteps(self, action_runner): |
245 action_runner.RunAction(NavigateAction()) | 245 action_runner.RunAction(NavigateAction()) |
246 action_runner.RunAction(WaitAction({'seconds':2})) | 246 action_runner.RunAction(WaitAction({'seconds':2})) |
247 | 247 |
| 248 |
| 249 class YahooAnswersPage(ToughPinchZoomCasesPage): |
| 250 |
| 251 """ Why: #1 Alexa reference """ |
| 252 |
| 253 def __init__(self, page_set): |
| 254 super(YahooAnswersPage, self).__init__( |
| 255 url='http://answers.yahoo.com', |
| 256 page_set=page_set) |
| 257 |
| 258 def RunSmoothness(self, action_runner): |
| 259 action_runner.RunAction(PinchAction( |
| 260 { |
| 261 'element_function': ''' |
| 262 function(callback) { |
| 263 callback(document.getElementById("ya-content-apps")) |
| 264 }''' |
| 265 })) |
| 266 |
| 267 |
248 class ToughPinchZoomCasesPageSet(page_set_module.PageSet): | 268 class ToughPinchZoomCasesPageSet(page_set_module.PageSet): |
249 | 269 |
250 """ Set of pages that are tricky to pinch-zoom """ | 270 """ Set of pages that are tricky to pinch-zoom """ |
251 | 271 |
252 def __init__(self): | 272 def __init__(self): |
253 super(ToughPinchZoomCasesPageSet, self).__init__( | 273 super(ToughPinchZoomCasesPageSet, self).__init__( |
254 credentials_path='data/credentials.json', | 274 credentials_path='data/credentials.json', |
255 user_agent_type='desktop', | 275 user_agent_type='desktop', |
256 archive_data_file='data/tough_pinch_zoom_cases.json') | 276 archive_data_file='data/tough_pinch_zoom_cases.json') |
257 | 277 |
(...skipping 23 matching lines...) Expand all Loading... |
281 self.AddPage(ToughPinchZoomCasesPage('http://www.amazon.com', self)) | 301 self.AddPage(ToughPinchZoomCasesPage('http://www.amazon.com', self)) |
282 | 302 |
283 # Why: #1 commerce website by time spent by users in US | 303 # Why: #1 commerce website by time spent by users in US |
284 self.AddPage(ToughPinchZoomCasesPage('http://www.ebay.com', self)) | 304 self.AddPage(ToughPinchZoomCasesPage('http://www.ebay.com', self)) |
285 | 305 |
286 self.AddPage(YahooGamePage(self)) | 306 self.AddPage(YahooGamePage(self)) |
287 | 307 |
288 # Why: #1 Alexa recreation | 308 # Why: #1 Alexa recreation |
289 self.AddPage(ToughPinchZoomCasesPage('http://booking.com', self)) | 309 self.AddPage(ToughPinchZoomCasesPage('http://booking.com', self)) |
290 | 310 |
291 # Why: #1 Alexa reference | 311 self.AddPage(YahooAnswersPage(self)) |
292 self.AddPage(ToughPinchZoomCasesPage('http://answers.yahoo.com', self)) | |
293 | 312 |
294 # Why: #1 Alexa sports | 313 # Why: #1 Alexa sports |
295 self.AddPage(ToughPinchZoomCasesPage('http://sports.yahoo.com/', self)) | 314 self.AddPage(ToughPinchZoomCasesPage('http://sports.yahoo.com/', self)) |
OLD | NEW |