| 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 shared_page_state | 5 from telemetry.page import shared_page_state |
| 6 | 6 |
| 7 from page_sets.login_helpers import google_login | |
| 8 | |
| 9 | 7 |
| 10 class TopPages(page_module.Page): | 8 class TopPages(page_module.Page): |
| 11 | 9 |
| 12 def __init__(self, url, page_set, shared_page_state_class, | 10 def __init__(self, url, page_set, shared_page_state_class, |
| 13 name='', credentials=None): | 11 name='', credentials=None): |
| 14 super(TopPages, self).__init__( | 12 super(TopPages, self).__init__( |
| 15 url=url, page_set=page_set, name=name, | 13 url=url, page_set=page_set, name=name, |
| 16 credentials_path='data/credentials.json', | 14 credentials_path='data/credentials.json', |
| 17 shared_page_state_class=shared_page_state_class) | 15 shared_page_state_class=shared_page_state_class) |
| 18 self.archive_data_file = 'data/top_25.json' | 16 self.archive_data_file = 'data/top_25.json' |
| (...skipping 30 matching lines...) Expand all Loading... |
| 49 | 47 |
| 50 class GmailPage(TopPages): | 48 class GmailPage(TopPages): |
| 51 | 49 |
| 52 """ Why: productivity, top google properties """ | 50 """ Why: productivity, top google properties """ |
| 53 | 51 |
| 54 def __init__(self, page_set, | 52 def __init__(self, page_set, |
| 55 shared_page_state_class=shared_page_state.SharedPageState): | 53 shared_page_state_class=shared_page_state.SharedPageState): |
| 56 super(GmailPage, self).__init__( | 54 super(GmailPage, self).__init__( |
| 57 url='https://mail.google.com/mail/', | 55 url='https://mail.google.com/mail/', |
| 58 page_set=page_set, | 56 page_set=page_set, |
| 57 credentials='google', |
| 59 shared_page_state_class=shared_page_state_class) | 58 shared_page_state_class=shared_page_state_class) |
| 60 | 59 |
| 61 def RunNavigateSteps(self, action_runner): | 60 def RunNavigateSteps(self, action_runner): |
| 62 google_login.LoginGoogleAccount(action_runner, 'google3', | |
| 63 self.credentials_path) | |
| 64 super(GmailPage, self).RunNavigateSteps(action_runner) | 61 super(GmailPage, self).RunNavigateSteps(action_runner) |
| 65 action_runner.WaitForJavaScriptCondition( | 62 action_runner.WaitForJavaScriptCondition( |
| 66 'window.gmonkey !== undefined &&' | 63 'window.gmonkey !== undefined &&' |
| 67 'document.getElementById("gb") !== null', | 64 'document.getElementById("gb") !== null') |
| 68 timeout_in_seconds=120) | |
| 69 | 65 |
| 70 | 66 |
| 71 class GoogleCalendarPage(TopPages): | 67 class GoogleCalendarPage(TopPages): |
| 72 | 68 |
| 73 """ Why: productivity, top google properties """ | 69 """ Why: productivity, top google properties """ |
| 74 | 70 |
| 75 def __init__(self, page_set, | 71 def __init__(self, page_set, |
| 76 shared_page_state_class=shared_page_state.SharedPageState): | 72 shared_page_state_class=shared_page_state.SharedPageState): |
| 77 super(GoogleCalendarPage, self).__init__( | 73 super(GoogleCalendarPage, self).__init__( |
| 78 url='https://www.google.com/calendar/', | 74 url='https://www.google.com/calendar/', |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 def __init__(self, page_set, | 286 def __init__(self, page_set, |
| 291 shared_page_state_class=shared_page_state.SharedPageState): | 287 shared_page_state_class=shared_page_state.SharedPageState): |
| 292 super(YahooGamesPage, self).__init__( | 288 super(YahooGamesPage, self).__init__( |
| 293 url='http://games.yahoo.com', | 289 url='http://games.yahoo.com', |
| 294 page_set=page_set, | 290 page_set=page_set, |
| 295 shared_page_state_class=shared_page_state_class) | 291 shared_page_state_class=shared_page_state_class) |
| 296 | 292 |
| 297 def RunNavigateSteps(self, action_runner): | 293 def RunNavigateSteps(self, action_runner): |
| 298 super(YahooGamesPage, self).RunNavigateSteps(action_runner) | 294 super(YahooGamesPage, self).RunNavigateSteps(action_runner) |
| 299 action_runner.Wait(2) | 295 action_runner.Wait(2) |
| OLD | NEW |