| 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 KeyMobileSitesPage(page_module.Page): | 8 class KeyMobileSitesPage(page_module.Page): |
| 9 | 9 |
| 10 def __init__(self, url, page_set, name='', tags=None): | 10 def __init__(self, url, page_set, name='', tags=None): |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 def __init__(self, page_set): | 22 def __init__(self, page_set): |
| 23 super(CapitolVolkswagenPage, self).__init__( | 23 super(CapitolVolkswagenPage, self).__init__( |
| 24 url=('http://iphone.capitolvolkswagen.com/index.htm' | 24 url=('http://iphone.capitolvolkswagen.com/index.htm' |
| 25 '#new-inventory_p_2Fsb-new_p_2Ehtm_p_3Freset_p_3DInventoryListing'), | 25 '#new-inventory_p_2Fsb-new_p_2Ehtm_p_3Freset_p_3DInventoryListing'), |
| 26 page_set=page_set) | 26 page_set=page_set) |
| 27 | 27 |
| 28 def RunNavigateSteps(self, action_runner): | 28 def RunNavigateSteps(self, action_runner): |
| 29 super(CapitolVolkswagenPage, self).RunNavigateSteps(action_runner) | 29 super(CapitolVolkswagenPage, self).RunNavigateSteps(action_runner) |
| 30 action_runner.WaitForElement(text='Next 35') | 30 action_runner.WaitForElement(text='Next 35') |
| 31 action_runner.WaitForJavaScriptCondition2( | 31 action_runner.WaitForJavaScriptCondition( |
| 32 'document.body.scrollHeight > 2560') | 32 'document.body.scrollHeight > 2560') |
| 33 | 33 |
| 34 | 34 |
| 35 | 35 |
| 36 class TheVergeArticlePage(KeyMobileSitesPage): | 36 class TheVergeArticlePage(KeyMobileSitesPage): |
| 37 | 37 |
| 38 """ Why: Top tech blog """ | 38 """ Why: Top tech blog """ |
| 39 | 39 |
| 40 def __init__(self, page_set): | 40 def __init__(self, page_set): |
| 41 super(TheVergeArticlePage, self).__init__( | 41 super(TheVergeArticlePage, self).__init__( |
| 42 # pylint: disable=line-too-long | 42 # pylint: disable=line-too-long |
| 43 url='http://www.theverge.com/2012/10/28/3568746/amazon-7-inch-fire-hd-ipad
-mini-ad-ballsy', | 43 url='http://www.theverge.com/2012/10/28/3568746/amazon-7-inch-fire-hd-ipad
-mini-ad-ballsy', |
| 44 page_set=page_set) | 44 page_set=page_set) |
| 45 | 45 |
| 46 def RunNavigateSteps(self, action_runner): | 46 def RunNavigateSteps(self, action_runner): |
| 47 super(TheVergeArticlePage, self).RunNavigateSteps(action_runner) | 47 super(TheVergeArticlePage, self).RunNavigateSteps(action_runner) |
| 48 action_runner.WaitForJavaScriptCondition2( | 48 action_runner.WaitForJavaScriptCondition( |
| 49 'window.Chorus !== undefined &&' | 49 'window.Chorus !== undefined &&' |
| 50 'window.Chorus.Comments !== undefined &&' | 50 'window.Chorus.Comments !== undefined &&' |
| 51 'window.Chorus.Comments.Json !== undefined &&' | 51 'window.Chorus.Comments.Json !== undefined &&' |
| 52 '(window.Chorus.Comments.loaded ||' | 52 '(window.Chorus.Comments.loaded ||' |
| 53 ' window.Chorus.Comments.Json.load_comments())') | 53 ' window.Chorus.Comments.Json.load_comments())') |
| 54 | 54 |
| 55 | 55 |
| 56 class CnnArticlePage(KeyMobileSitesPage): | 56 class CnnArticlePage(KeyMobileSitesPage): |
| 57 | 57 |
| 58 """ Why: Top news site """ | 58 """ Why: Top news site """ |
| (...skipping 14 matching lines...) Expand all Loading... |
| 73 | 73 |
| 74 """ Why: #1 (Alexa global) """ | 74 """ Why: #1 (Alexa global) """ |
| 75 | 75 |
| 76 def __init__(self, page_set): | 76 def __init__(self, page_set): |
| 77 super(FacebookPage, self).__init__( | 77 super(FacebookPage, self).__init__( |
| 78 url='https://facebook.com/barackobama', | 78 url='https://facebook.com/barackobama', |
| 79 page_set=page_set) | 79 page_set=page_set) |
| 80 | 80 |
| 81 def RunNavigateSteps(self, action_runner): | 81 def RunNavigateSteps(self, action_runner): |
| 82 super(FacebookPage, self).RunNavigateSteps(action_runner) | 82 super(FacebookPage, self).RunNavigateSteps(action_runner) |
| 83 action_runner.WaitForJavaScriptCondition2( | 83 action_runner.WaitForJavaScriptCondition( |
| 84 'document.getElementById("u_0_c") !== null &&' | 84 'document.getElementById("u_0_c") !== null &&' |
| 85 'document.body.scrollHeight > window.innerHeight') | 85 'document.body.scrollHeight > window.innerHeight') |
| 86 | 86 |
| 87 | 87 |
| 88 class YoutubeMobilePage(KeyMobileSitesPage): | 88 class YoutubeMobilePage(KeyMobileSitesPage): |
| 89 | 89 |
| 90 """ Why: #3 (Alexa global) """ | 90 """ Why: #3 (Alexa global) """ |
| 91 | 91 |
| 92 def __init__(self, page_set): | 92 def __init__(self, page_set): |
| 93 super(YoutubeMobilePage, self).__init__( | 93 super(YoutubeMobilePage, self).__init__( |
| 94 url='http://m.youtube.com/watch?v=9hBpF_Zj4OA', | 94 url='http://m.youtube.com/watch?v=9hBpF_Zj4OA', |
| 95 page_set=page_set) | 95 page_set=page_set) |
| 96 | 96 |
| 97 def RunNavigateSteps(self, action_runner): | 97 def RunNavigateSteps(self, action_runner): |
| 98 super(YoutubeMobilePage, self).RunNavigateSteps(action_runner) | 98 super(YoutubeMobilePage, self).RunNavigateSteps(action_runner) |
| 99 action_runner.WaitForJavaScriptCondition2( | 99 action_runner.WaitForJavaScriptCondition( |
| 100 'document.getElementById("paginatortarget") !== null') | 100 'document.getElementById("paginatortarget") !== null') |
| 101 | 101 |
| 102 | 102 |
| 103 class LinkedInPage(KeyMobileSitesPage): | 103 class LinkedInPage(KeyMobileSitesPage): |
| 104 | 104 |
| 105 """ Why: #12 (Alexa global),Public profile """ | 105 """ Why: #12 (Alexa global),Public profile """ |
| 106 | 106 |
| 107 def __init__(self, page_set): | 107 def __init__(self, page_set): |
| 108 super(LinkedInPage, self).__init__( | 108 super(LinkedInPage, self).__init__( |
| 109 url='https://www.linkedin.com/in/linustorvalds', | 109 url='https://www.linkedin.com/in/linustorvalds', |
| 110 page_set=page_set, | 110 page_set=page_set, |
| 111 name='LinkedIn') | 111 name='LinkedIn') |
| 112 | 112 |
| 113 def RunNavigateSteps(self, action_runner): | 113 def RunNavigateSteps(self, action_runner): |
| 114 super(LinkedInPage, self).RunNavigateSteps(action_runner) | 114 super(LinkedInPage, self).RunNavigateSteps(action_runner) |
| 115 action_runner.WaitForJavaScriptCondition2( | 115 action_runner.WaitForJavaScriptCondition( |
| 116 'document.getElementById("profile-view-scroller") !== null') | 116 'document.getElementById("profile-view-scroller") !== null') |
| 117 | 117 |
| 118 | 118 |
| 119 | 119 |
| 120 class YahooAnswersPage(KeyMobileSitesPage): | 120 class YahooAnswersPage(KeyMobileSitesPage): |
| 121 | 121 |
| 122 """ Why: #1 Alexa reference """ | 122 """ Why: #1 Alexa reference """ |
| 123 | 123 |
| 124 def __init__(self, page_set): | 124 def __init__(self, page_set): |
| 125 super(YahooAnswersPage, self).__init__( | 125 super(YahooAnswersPage, self).__init__( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 139 | 139 |
| 140 def __init__(self, page_set): | 140 def __init__(self, page_set): |
| 141 super(GmailPage, self).__init__( | 141 super(GmailPage, self).__init__( |
| 142 url='https://mail.google.com/mail/', | 142 url='https://mail.google.com/mail/', |
| 143 page_set=page_set) | 143 page_set=page_set) |
| 144 | 144 |
| 145 self.credentials = 'google' | 145 self.credentials = 'google' |
| 146 | 146 |
| 147 def RunNavigateSteps(self, action_runner): | 147 def RunNavigateSteps(self, action_runner): |
| 148 super(GmailPage, self).RunNavigateSteps(action_runner) | 148 super(GmailPage, self).RunNavigateSteps(action_runner) |
| 149 action_runner.WaitForJavaScriptCondition2( | 149 action_runner.WaitForJavaScriptCondition( |
| 150 'document.getElementById("og_user_warning") !== null') | 150 'document.getElementById("og_user_warning") !== null') |
| 151 action_runner.WaitForJavaScriptCondition2( | 151 action_runner.WaitForJavaScriptCondition( |
| 152 'document.getElementById("og_user_warning") === null') | 152 'document.getElementById("og_user_warning") === null') |
| 153 | 153 |
| 154 | 154 |
| 155 class GroupClonedPage(KeyMobileSitesPage): | 155 class GroupClonedPage(KeyMobileSitesPage): |
| 156 | 156 |
| 157 """ Why: crbug.com/172906 """ | 157 """ Why: crbug.com/172906 """ |
| 158 | 158 |
| 159 def __init__(self, page_set): | 159 def __init__(self, page_set): |
| 160 super(GroupClonedPage, self).__init__( | 160 super(GroupClonedPage, self).__init__( |
| 161 url='http://groupcloned.com', | 161 url='http://groupcloned.com', |
| 162 page_set=page_set) | 162 page_set=page_set) |
| 163 | 163 |
| 164 | 164 |
| 165 def RunNavigateSteps(self, action_runner): | 165 def RunNavigateSteps(self, action_runner): |
| 166 super(GroupClonedPage, self).RunNavigateSteps(action_runner) | 166 super(GroupClonedPage, self).RunNavigateSteps(action_runner) |
| 167 action_runner.Wait(5) | 167 action_runner.Wait(5) |
| 168 action_runner.WaitForJavaScriptCondition2(''' | 168 action_runner.WaitForJavaScriptCondition(''' |
| 169 document.getElementById("element-19") !== null && | 169 document.getElementById("element-19") !== null && |
| 170 document.getElementById("element-19").contentDocument | 170 document.getElementById("element-19").contentDocument |
| 171 .getElementById("element-22") !== null && | 171 .getElementById("element-22") !== null && |
| 172 document.getElementById("element-19").contentDocument | 172 document.getElementById("element-19").contentDocument |
| 173 .getElementsByClassName( | 173 .getElementsByClassName( |
| 174 "container list-item gc-list-item stretched").length !== 0''') | 174 "container list-item gc-list-item stretched").length !== 0''') |
| 175 | 175 |
| 176 | 176 |
| 177 class GroupClonedListImagesPage(KeyMobileSitesPage): | 177 class GroupClonedListImagesPage(KeyMobileSitesPage): |
| 178 | 178 |
| 179 """ Why: crbug.com/172906 """ | 179 """ Why: crbug.com/172906 """ |
| 180 | 180 |
| 181 def __init__(self, page_set): | 181 def __init__(self, page_set): |
| 182 super(GroupClonedListImagesPage, self).__init__( | 182 super(GroupClonedListImagesPage, self).__init__( |
| 183 url='http://groupcloned.com/test/list-images-variable/index.html', | 183 url='http://groupcloned.com/test/list-images-variable/index.html', |
| 184 page_set=page_set) | 184 page_set=page_set) |
| 185 | 185 |
| 186 def RunNavigateSteps(self, action_runner): | 186 def RunNavigateSteps(self, action_runner): |
| 187 super(GroupClonedListImagesPage, self).RunNavigateSteps(action_runner) | 187 super(GroupClonedListImagesPage, self).RunNavigateSteps(action_runner) |
| 188 action_runner.WaitForJavaScriptCondition2( | 188 action_runner.WaitForJavaScriptCondition( |
| 189 'document.getElementById("element-5") !== null') | 189 'document.getElementById("element-5") !== null') |
| 190 | 190 |
| 191 | 191 |
| 192 class GoogleNewsMobilePage(KeyMobileSitesPage): | 192 class GoogleNewsMobilePage(KeyMobileSitesPage): |
| 193 | 193 |
| 194 """ Why: Google News: accelerated scrolling version """ | 194 """ Why: Google News: accelerated scrolling version """ |
| 195 | 195 |
| 196 def __init__(self, page_set): | 196 def __init__(self, page_set): |
| 197 super(GoogleNewsMobilePage, self).__init__( | 197 super(GoogleNewsMobilePage, self).__init__( |
| 198 url='http://mobile-news.sandbox.google.com/news/pt1', | 198 url='http://mobile-news.sandbox.google.com/news/pt1', |
| 199 page_set=page_set) | 199 page_set=page_set) |
| 200 | 200 |
| 201 def RunNavigateSteps(self, action_runner): | 201 def RunNavigateSteps(self, action_runner): |
| 202 super(GoogleNewsMobilePage, self).RunNavigateSteps(action_runner) | 202 super(GoogleNewsMobilePage, self).RunNavigateSteps(action_runner) |
| 203 action_runner.WaitForJavaScriptCondition2( | 203 action_runner.WaitForJavaScriptCondition( |
| 204 'typeof NEWS_telemetryReady !== "undefined" && ' | 204 'typeof NEWS_telemetryReady !== "undefined" && ' |
| 205 'NEWS_telemetryReady == true') | 205 'NEWS_telemetryReady == true') |
| 206 | 206 |
| 207 | 207 |
| 208 class GoogleNewsMobile2Page(KeyMobileSitesPage): | 208 class GoogleNewsMobile2Page(KeyMobileSitesPage): |
| 209 | 209 |
| 210 """ | 210 """ |
| 211 Why: Google News: this iOS version is slower than accelerated scrolling | 211 Why: Google News: this iOS version is slower than accelerated scrolling |
| 212 """ | 212 """ |
| 213 | 213 |
| 214 def __init__(self, page_set): | 214 def __init__(self, page_set): |
| 215 super(GoogleNewsMobile2Page, self).__init__( | 215 super(GoogleNewsMobile2Page, self).__init__( |
| 216 url='http://mobile-news.sandbox.google.com/news/pt0', | 216 url='http://mobile-news.sandbox.google.com/news/pt0', |
| 217 page_set=page_set) | 217 page_set=page_set) |
| 218 | 218 |
| 219 def RunNavigateSteps(self, action_runner): | 219 def RunNavigateSteps(self, action_runner): |
| 220 super(GoogleNewsMobile2Page, self).RunNavigateSteps(action_runner) | 220 super(GoogleNewsMobile2Page, self).RunNavigateSteps(action_runner) |
| 221 action_runner.WaitForJavaScriptCondition2( | 221 action_runner.WaitForJavaScriptCondition( |
| 222 'document.getElementById(":h") != null') | 222 'document.getElementById(":h") != null') |
| 223 action_runner.Wait(1) | 223 action_runner.Wait(1) |
| 224 | 224 |
| 225 | 225 |
| 226 class AmazonNicolasCagePage(KeyMobileSitesPage): | 226 class AmazonNicolasCagePage(KeyMobileSitesPage): |
| 227 | 227 |
| 228 """ | 228 """ |
| 229 Why: #1 world commerce website by visits; #3 commerce in the US by time spent | 229 Why: #1 world commerce website by visits; #3 commerce in the US by time spent |
| 230 """ | 230 """ |
| 231 | 231 |
| 232 def __init__(self, page_set): | 232 def __init__(self, page_set): |
| 233 super(AmazonNicolasCagePage, self).__init__( | 233 super(AmazonNicolasCagePage, self).__init__( |
| 234 url='http://www.amazon.com/gp/aw/s/ref=is_box_?k=nicolas+cage', | 234 url='http://www.amazon.com/gp/aw/s/ref=is_box_?k=nicolas+cage', |
| 235 page_set=page_set) | 235 page_set=page_set) |
| OLD | NEW |