| 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 | 7 |
| 8 class TopPages(page_module.Page): | 8 class TopPages(page_module.Page): |
| 9 | 9 |
| 10 def __init__(self, url, page_set, shared_page_state_class, | 10 def __init__(self, url, page_set, shared_page_state_class, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 def __init__(self, page_set, | 52 def __init__(self, page_set, |
| 53 shared_page_state_class=shared_page_state.SharedPageState): | 53 shared_page_state_class=shared_page_state.SharedPageState): |
| 54 super(GmailPage, self).__init__( | 54 super(GmailPage, self).__init__( |
| 55 url='https://mail.google.com/mail/', | 55 url='https://mail.google.com/mail/', |
| 56 page_set=page_set, | 56 page_set=page_set, |
| 57 credentials='google', | 57 credentials='google', |
| 58 shared_page_state_class=shared_page_state_class) | 58 shared_page_state_class=shared_page_state_class) |
| 59 | 59 |
| 60 def RunNavigateSteps(self, action_runner): | 60 def RunNavigateSteps(self, action_runner): |
| 61 super(GmailPage, self).RunNavigateSteps(action_runner) | 61 super(GmailPage, self).RunNavigateSteps(action_runner) |
| 62 action_runner.WaitForJavaScriptCondition2( | 62 action_runner.WaitForJavaScriptCondition( |
| 63 'window.gmonkey !== undefined &&' | 63 'window.gmonkey !== undefined &&' |
| 64 'document.getElementById("gb") !== null') | 64 'document.getElementById("gb") !== null') |
| 65 | 65 |
| 66 | 66 |
| 67 class GoogleCalendarPage(TopPages): | 67 class GoogleCalendarPage(TopPages): |
| 68 | 68 |
| 69 """ Why: productivity, top google properties """ | 69 """ Why: productivity, top google properties """ |
| 70 | 70 |
| 71 def __init__(self, page_set, | 71 def __init__(self, page_set, |
| 72 shared_page_state_class=shared_page_state.SharedPageState): | 72 shared_page_state_class=shared_page_state.SharedPageState): |
| 73 super(GoogleCalendarPage, self).__init__( | 73 super(GoogleCalendarPage, self).__init__( |
| 74 url='https://www.google.com/calendar/', | 74 url='https://www.google.com/calendar/', |
| 75 page_set=page_set, | 75 page_set=page_set, |
| 76 credentials='google', | 76 credentials='google', |
| 77 shared_page_state_class=shared_page_state_class) | 77 shared_page_state_class=shared_page_state_class) |
| 78 | 78 |
| 79 def RunNavigateSteps(self, action_runner): | 79 def RunNavigateSteps(self, action_runner): |
| 80 super(GoogleCalendarPage, self).RunNavigateSteps(action_runner) | 80 super(GoogleCalendarPage, self).RunNavigateSteps(action_runner) |
| 81 action_runner.Wait(2) | 81 action_runner.Wait(2) |
| 82 action_runner.WaitForElement('div[class~="navForward"]') | 82 action_runner.WaitForElement('div[class~="navForward"]') |
| 83 action_runner.ExecuteJavaScript2(''' | 83 action_runner.ExecuteJavaScript(''' |
| 84 (function() { | 84 (function() { |
| 85 var elem = document.createElement('meta'); | 85 var elem = document.createElement('meta'); |
| 86 elem.name='viewport'; | 86 elem.name='viewport'; |
| 87 elem.content='initial-scale=1'; | 87 elem.content='initial-scale=1'; |
| 88 document.body.appendChild(elem); | 88 document.body.appendChild(elem); |
| 89 })();''') | 89 })();''') |
| 90 action_runner.Wait(1) | 90 action_runner.Wait(1) |
| 91 | 91 |
| 92 | 92 |
| 93 class GoogleDocPage(TopPages): | 93 class GoogleDocPage(TopPages): |
| 94 | 94 |
| 95 """ Why: productivity, top google properties; Sample doc in the link """ | 95 """ Why: productivity, top google properties; Sample doc in the link """ |
| 96 | 96 |
| 97 def __init__(self, page_set, | 97 def __init__(self, page_set, |
| 98 shared_page_state_class=shared_page_state.SharedPageState): | 98 shared_page_state_class=shared_page_state.SharedPageState): |
| 99 super(GoogleDocPage, self).__init__( | 99 super(GoogleDocPage, self).__init__( |
| 100 # pylint: disable=line-too-long | 100 # pylint: disable=line-too-long |
| 101 url='https://docs.google.com/document/d/1X-IKNjtEnx-WW5JIKRLsyhz5sbsat3m
fTpAPUSX3_s4/view', | 101 url='https://docs.google.com/document/d/1X-IKNjtEnx-WW5JIKRLsyhz5sbsat3m
fTpAPUSX3_s4/view', |
| 102 page_set=page_set, | 102 page_set=page_set, |
| 103 name='Docs (1 open document tab)', | 103 name='Docs (1 open document tab)', |
| 104 credentials='google', | 104 credentials='google', |
| 105 shared_page_state_class=shared_page_state_class) | 105 shared_page_state_class=shared_page_state_class) |
| 106 | 106 |
| 107 def RunNavigateSteps(self, action_runner): | 107 def RunNavigateSteps(self, action_runner): |
| 108 super(GoogleDocPage, self).RunNavigateSteps(action_runner) | 108 super(GoogleDocPage, self).RunNavigateSteps(action_runner) |
| 109 action_runner.Wait(2) | 109 action_runner.Wait(2) |
| 110 action_runner.WaitForJavaScriptCondition2( | 110 action_runner.WaitForJavaScriptCondition( |
| 111 'document.getElementsByClassName("kix-appview-editor").length') | 111 'document.getElementsByClassName("kix-appview-editor").length') |
| 112 | 112 |
| 113 | 113 |
| 114 class GooglePlusPage(TopPages): | 114 class GooglePlusPage(TopPages): |
| 115 | 115 |
| 116 """ Why: social; top google property; Public profile; infinite scrolls """ | 116 """ Why: social; top google property; Public profile; infinite scrolls """ |
| 117 | 117 |
| 118 def __init__(self, page_set, | 118 def __init__(self, page_set, |
| 119 shared_page_state_class=shared_page_state.SharedPageState): | 119 shared_page_state_class=shared_page_state.SharedPageState): |
| 120 super(GooglePlusPage, self).__init__( | 120 super(GooglePlusPage, self).__init__( |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 def __init__(self, page_set, | 286 def __init__(self, page_set, |
| 287 shared_page_state_class=shared_page_state.SharedPageState): | 287 shared_page_state_class=shared_page_state.SharedPageState): |
| 288 super(YahooGamesPage, self).__init__( | 288 super(YahooGamesPage, self).__init__( |
| 289 url='http://games.yahoo.com', | 289 url='http://games.yahoo.com', |
| 290 page_set=page_set, | 290 page_set=page_set, |
| 291 shared_page_state_class=shared_page_state_class) | 291 shared_page_state_class=shared_page_state_class) |
| 292 | 292 |
| 293 def RunNavigateSteps(self, action_runner): | 293 def RunNavigateSteps(self, action_runner): |
| 294 super(YahooGamesPage, self).RunNavigateSteps(action_runner) | 294 super(YahooGamesPage, self).RunNavigateSteps(action_runner) |
| 295 action_runner.Wait(2) | 295 action_runner.Wait(2) |
| OLD | NEW |