| 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 12 matching lines...) Expand all Loading... |
| 23 class GoogleSearchPage(ToughPinchZoomCasesPage): | 23 class GoogleSearchPage(ToughPinchZoomCasesPage): |
| 24 | 24 |
| 25 """ Why: top google property; a google tab is often open. """ | 25 """ Why: top google property; a google tab is often open. """ |
| 26 | 26 |
| 27 def __init__(self, page_set): | 27 def __init__(self, page_set): |
| 28 super(GoogleSearchPage, self).__init__( | 28 super(GoogleSearchPage, self).__init__( |
| 29 url='https://www.google.com/#hl=en&q=barack+obama', | 29 url='https://www.google.com/#hl=en&q=barack+obama', |
| 30 page_set=page_set) | 30 page_set=page_set) |
| 31 | 31 |
| 32 def RunNavigateSteps(self, action_runner): | 32 def RunNavigateSteps(self, action_runner): |
| 33 action_runner.RunAction(NavigateAction()) | 33 action_runner.NavigateToPage(self) |
| 34 action_runner.RunAction(WaitAction( | 34 action_runner.RunAction(WaitAction( |
| 35 { | 35 { |
| 36 'text': 'Next', | 36 'text': 'Next', |
| 37 'condition': 'element' | 37 'condition': 'element' |
| 38 })) | 38 })) |
| 39 | 39 |
| 40 | 40 |
| 41 class GmailPage(ToughPinchZoomCasesPage): | 41 class GmailPage(ToughPinchZoomCasesPage): |
| 42 | 42 |
| 43 """ Why: productivity, top google properties """ | 43 """ Why: productivity, top google properties """ |
| 44 | 44 |
| 45 def __init__(self, page_set): | 45 def __init__(self, page_set): |
| 46 super(GmailPage, self).__init__( | 46 super(GmailPage, self).__init__( |
| 47 url='https://mail.google.com/mail/', | 47 url='https://mail.google.com/mail/', |
| 48 page_set=page_set) | 48 page_set=page_set) |
| 49 | 49 |
| 50 self.credentials = 'google' | 50 self.credentials = 'google' |
| 51 | 51 |
| 52 def RunNavigateSteps(self, action_runner): | 52 def RunNavigateSteps(self, action_runner): |
| 53 action_runner.RunAction(NavigateAction()) | 53 action_runner.NavigateToPage(self) |
| 54 action_runner.RunAction(WaitAction( | 54 action_runner.RunAction(WaitAction( |
| 55 { | 55 { |
| 56 'javascript' : ( | 56 'javascript' : ( |
| 57 'window.gmonkey !== undefined &&' | 57 'window.gmonkey !== undefined &&' |
| 58 'document.getElementById("gb") !== null') | 58 'document.getElementById("gb") !== null') |
| 59 })) | 59 })) |
| 60 | 60 |
| 61 | 61 |
| 62 class GoogleCalendarPage(ToughPinchZoomCasesPage): | 62 class GoogleCalendarPage(ToughPinchZoomCasesPage): |
| 63 | 63 |
| 64 """ Why: productivity, top google properties """ | 64 """ Why: productivity, top google properties """ |
| 65 | 65 |
| 66 def __init__(self, page_set): | 66 def __init__(self, page_set): |
| 67 super(GoogleCalendarPage, self).__init__( | 67 super(GoogleCalendarPage, self).__init__( |
| 68 url='https://www.google.com/calendar/', | 68 url='https://www.google.com/calendar/', |
| 69 page_set=page_set) | 69 page_set=page_set) |
| 70 | 70 |
| 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.NavigateToPage(self) |
| 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.1 |
| 82 })) | 82 })) |
| 83 | 83 |
| 84 | 84 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 99 """ Why: social; top google property; Public profile; infinite scrolls """ | 99 """ Why: social; top google property; Public profile; infinite scrolls """ |
| 100 | 100 |
| 101 def __init__(self, page_set): | 101 def __init__(self, page_set): |
| 102 super(GooglePlusPage, self).__init__( | 102 super(GooglePlusPage, self).__init__( |
| 103 url='https://plus.google.com/+BarackObama/posts', | 103 url='https://plus.google.com/+BarackObama/posts', |
| 104 page_set=page_set) | 104 page_set=page_set) |
| 105 | 105 |
| 106 self.credentials = 'google' | 106 self.credentials = 'google' |
| 107 | 107 |
| 108 def RunNavigateSteps(self, action_runner): | 108 def RunNavigateSteps(self, action_runner): |
| 109 action_runner.RunAction(NavigateAction()) | 109 action_runner.NavigateToPage(self) |
| 110 action_runner.RunAction(WaitAction( | 110 action_runner.RunAction(WaitAction( |
| 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.getElementsByClassName("Ct")[0]) |
| 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__( |
| 132 url='http://www.youtube.com', | 132 url='http://www.youtube.com', |
| 133 page_set=page_set) | 133 page_set=page_set) |
| 134 | 134 |
| 135 self.credentials = 'google' | 135 self.credentials = 'google' |
| 136 | 136 |
| 137 def RunNavigateSteps(self, action_runner): | 137 def RunNavigateSteps(self, action_runner): |
| 138 action_runner.RunAction(NavigateAction()) | 138 action_runner.NavigateToPage(self) |
| 139 action_runner.RunAction(WaitAction({'seconds':2})) | 139 action_runner.RunAction(WaitAction({'seconds':2})) |
| 140 | 140 |
| 141 class BlogSpotPage(ToughPinchZoomCasesPage): | 141 class BlogSpotPage(ToughPinchZoomCasesPage): |
| 142 | 142 |
| 143 """ | 143 """ |
| 144 Why: #11 (Alexa global), google property; some blogger layouts have infinite | 144 Why: #11 (Alexa global), google property; some blogger layouts have infinite |
| 145 scroll but more interesting | 145 scroll but more interesting |
| 146 """ | 146 """ |
| 147 | 147 |
| 148 def __init__(self, page_set): | 148 def __init__(self, page_set): |
| 149 super(BlogSpotPage, self).__init__( | 149 super(BlogSpotPage, self).__init__( |
| 150 url='http://googlewebmastercentral.blogspot.com/', | 150 url='http://googlewebmastercentral.blogspot.com/', |
| 151 page_set=page_set, name='Blogger') | 151 page_set=page_set, name='Blogger') |
| 152 | 152 |
| 153 def RunNavigateSteps(self, action_runner): | 153 def RunNavigateSteps(self, action_runner): |
| 154 action_runner.RunAction(NavigateAction()) | 154 action_runner.NavigateToPage(self) |
| 155 action_runner.RunAction(WaitAction( | 155 action_runner.RunAction(WaitAction( |
| 156 { | 156 { |
| 157 'text': 'accessibility', | 157 'text': 'accessibility', |
| 158 'condition': 'element' | 158 'condition': 'element' |
| 159 })) | 159 })) |
| 160 | 160 |
| 161 | 161 |
| 162 class FacebookPage(ToughPinchZoomCasesPage): | 162 class FacebookPage(ToughPinchZoomCasesPage): |
| 163 | 163 |
| 164 """ Why: top social,Public profile """ | 164 """ Why: top social,Public profile """ |
| 165 | 165 |
| 166 def __init__(self, page_set): | 166 def __init__(self, page_set): |
| 167 super(FacebookPage, self).__init__( | 167 super(FacebookPage, self).__init__( |
| 168 url='http://www.facebook.com/barackobama', | 168 url='http://www.facebook.com/barackobama', |
| 169 page_set=page_set, name='Facebook') | 169 page_set=page_set, name='Facebook') |
| 170 self.credentials = 'facebook' | 170 self.credentials = 'facebook' |
| 171 | 171 |
| 172 def RunNavigateSteps(self, action_runner): | 172 def RunNavigateSteps(self, action_runner): |
| 173 action_runner.RunAction(NavigateAction()) | 173 action_runner.NavigateToPage(self) |
| 174 action_runner.RunAction(WaitAction( | 174 action_runner.RunAction(WaitAction( |
| 175 { | 175 { |
| 176 'text': 'About', | 176 'text': 'About', |
| 177 'condition': 'element' | 177 'condition': 'element' |
| 178 })) | 178 })) |
| 179 | 179 |
| 180 | 180 |
| 181 class LinkedinPage(ToughPinchZoomCasesPage): | 181 class LinkedinPage(ToughPinchZoomCasesPage): |
| 182 | 182 |
| 183 """ Why: #12 (Alexa global),Public profile """ | 183 """ Why: #12 (Alexa global),Public profile """ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 201 class TwitterPage(ToughPinchZoomCasesPage): | 201 class TwitterPage(ToughPinchZoomCasesPage): |
| 202 | 202 |
| 203 """ Why: #8 (Alexa global),Picked an interesting page """ | 203 """ Why: #8 (Alexa global),Picked an interesting page """ |
| 204 | 204 |
| 205 def __init__(self, page_set): | 205 def __init__(self, page_set): |
| 206 super(TwitterPage, self).__init__( | 206 super(TwitterPage, self).__init__( |
| 207 url='https://twitter.com/katyperry', | 207 url='https://twitter.com/katyperry', |
| 208 page_set=page_set, name='Twitter') | 208 page_set=page_set, name='Twitter') |
| 209 | 209 |
| 210 def RunNavigateSteps(self, action_runner): | 210 def RunNavigateSteps(self, action_runner): |
| 211 action_runner.RunAction(NavigateAction()) | 211 action_runner.NavigateToPage(self) |
| 212 action_runner.RunAction(WaitAction({'seconds':2})) | 212 action_runner.RunAction(WaitAction({'seconds':2})) |
| 213 | 213 |
| 214 class ESPNPage(ToughPinchZoomCasesPage): | 214 class ESPNPage(ToughPinchZoomCasesPage): |
| 215 | 215 |
| 216 """ Why: #1 sports """ | 216 """ Why: #1 sports """ |
| 217 | 217 |
| 218 def __init__(self, page_set): | 218 def __init__(self, page_set): |
| 219 super(ESPNPage, self).__init__( | 219 super(ESPNPage, self).__init__( |
| 220 url='http://espn.go.com/nba', | 220 url='http://espn.go.com/nba', |
| 221 page_set=page_set, name='ESPN') | 221 page_set=page_set, name='ESPN') |
| (...skipping 13 matching lines...) Expand all Loading... |
| 235 class YahooGamePage(ToughPinchZoomCasesPage): | 235 class YahooGamePage(ToughPinchZoomCasesPage): |
| 236 | 236 |
| 237 """ Why: #1 games according to Alexa (with actual games in it) """ | 237 """ Why: #1 games according to Alexa (with actual games in it) """ |
| 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.NavigateToPage(self) |
| 246 action_runner.RunAction(WaitAction({'seconds':2})) | 246 action_runner.RunAction(WaitAction({'seconds':2})) |
| 247 | 247 |
| 248 class ToughPinchZoomCasesPageSet(page_set_module.PageSet): | 248 class ToughPinchZoomCasesPageSet(page_set_module.PageSet): |
| 249 | 249 |
| 250 """ Set of pages that are tricky to pinch-zoom """ | 250 """ Set of pages that are tricky to pinch-zoom """ |
| 251 | 251 |
| 252 def __init__(self): | 252 def __init__(self): |
| 253 super(ToughPinchZoomCasesPageSet, self).__init__( | 253 super(ToughPinchZoomCasesPageSet, self).__init__( |
| 254 credentials_path='data/credentials.json', | 254 credentials_path='data/credentials.json', |
| 255 user_agent_type='desktop', | 255 user_agent_type='desktop', |
| (...skipping 30 matching lines...) Expand all Loading... |
| 286 self.AddPage(YahooGamePage(self)) | 286 self.AddPage(YahooGamePage(self)) |
| 287 | 287 |
| 288 # Why: #1 Alexa recreation | 288 # Why: #1 Alexa recreation |
| 289 self.AddPage(ToughPinchZoomCasesPage('http://booking.com', self)) | 289 self.AddPage(ToughPinchZoomCasesPage('http://booking.com', self)) |
| 290 | 290 |
| 291 # Why: #1 Alexa reference | 291 # Why: #1 Alexa reference |
| 292 self.AddPage(ToughPinchZoomCasesPage('http://answers.yahoo.com', self)) | 292 self.AddPage(ToughPinchZoomCasesPage('http://answers.yahoo.com', self)) |
| 293 | 293 |
| 294 # Why: #1 Alexa sports | 294 # Why: #1 Alexa sports |
| 295 self.AddPage(ToughPinchZoomCasesPage('http://sports.yahoo.com/', self)) | 295 self.AddPage(ToughPinchZoomCasesPage('http://sports.yahoo.com/', self)) |
| OLD | NEW |