1# Copyright 2018 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4from telemetry.page import shared_page_state 5 6from page_sets.login_helpers import linkedin_login 7from page_sets.rendering import rendering_story 8from page_sets.rendering import story_tags 9from page_sets.system_health import platforms 10 11 12class TopRealWorldMobilePage(rendering_story.RenderingStory): 13 ABSTRACT_STORY = True 14 TAGS = [story_tags.TOP_REAL_WORLD_MOBILE] 15 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 16 17 def __init__(self, 18 page_set, 19 name_suffix='', 20 extra_browser_args=None, 21 shared_page_state_class=shared_page_state.SharedMobilePageState): 22 super(TopRealWorldMobilePage, self).__init__( 23 page_set=page_set, 24 name_suffix=name_suffix, 25 extra_browser_args=extra_browser_args, 26 shared_page_state_class=shared_page_state_class) 27 28 def RunPageInteractions(self, action_runner): 29 with action_runner.CreateGestureInteraction('ScrollAction'): 30 action_runner.ScrollPage() 31 32 33class CapitolVolkswagenMobile2018Page(TopRealWorldMobilePage): 34 """ Why: Typical mobile business site """ 35 BASE_NAME = 'capitolvolkswagen_mobile' 36 YEAR = '2018' 37 URL = 'https://www.capitolvolkswagen.com/' 38 39 def __init__(self, 40 page_set, 41 name_suffix='', 42 extra_browser_args=None, 43 shared_page_state_class=shared_page_state.SharedMobilePageState): 44 super(CapitolVolkswagenMobile2018Page, self).__init__( 45 page_set=page_set, 46 name_suffix=name_suffix, 47 extra_browser_args=extra_browser_args, 48 shared_page_state_class=shared_page_state_class) 49 50 51class TheVergeArticleMobile2018Page(TopRealWorldMobilePage): 52 """ Why: Top tech blog """ 53 BASE_NAME = 'theverge_article_mobile' 54 YEAR = '2018' 55 # pylint: disable=line-too-long 56 URL = 'https://www.theverge.com/2018/7/18/17582836/chrome-os-tablet-acer-chromebook-tab-10-android-ipad' 57 58 def __init__(self, 59 page_set, 60 name_suffix='', 61 extra_browser_args=None, 62 shared_page_state_class=shared_page_state.SharedMobilePageState): 63 super(TheVergeArticleMobile2018Page, self).__init__( 64 page_set=page_set, 65 name_suffix=name_suffix, 66 extra_browser_args=extra_browser_args, 67 shared_page_state_class=shared_page_state_class) 68 69 70class CnnArticleMobile2018Page(TopRealWorldMobilePage): 71 """ Why: Top news site """ 72 BASE_NAME = 'cnn_article_mobile' 73 YEAR = '2018' 74 # pylint: disable=line-too-long 75 URL = 'https://www.cnn.com/travel/article/airbus-a330-900-neo-tours-us-airports/index.html' 76 77 def __init__(self, 78 page_set, 79 name_suffix='', 80 extra_browser_args=None, 81 shared_page_state_class=shared_page_state.SharedMobilePageState): 82 super(CnnArticleMobile2018Page, self).__init__( 83 page_set=page_set, 84 name_suffix=name_suffix, 85 extra_browser_args=extra_browser_args, 86 shared_page_state_class=shared_page_state_class) 87 88 def RunNavigateSteps(self, action_runner): 89 super(CnnArticleMobile2018Page, self).RunNavigateSteps(action_runner) 90 action_runner.WaitForElement(selector='.Article__entitlement') 91 92 def RunPageInteractions(self, action_runner): 93 with action_runner.CreateGestureInteraction('ScrollAction'): 94 # With default top_start_ratio=0.5 the corresponding element in this page 95 # will not be in the root scroller. 96 action_runner.ScrollPage(top_start_ratio=0.01) 97 98 99class FacebookMobile2018Page(TopRealWorldMobilePage): 100 """ Why: #1 (Alexa global) """ 101 BASE_NAME = 'facebook_mobile' 102 YEAR = '2018' 103 URL = 'https://facebook.com/barackobama' 104 105 def __init__(self, 106 page_set, 107 name_suffix='', 108 extra_browser_args=None, 109 shared_page_state_class=shared_page_state.SharedMobilePageState): 110 super(FacebookMobile2018Page, self).__init__( 111 page_set=page_set, 112 name_suffix=name_suffix, 113 extra_browser_args=extra_browser_args, 114 shared_page_state_class=shared_page_state_class) 115 116 def RunNavigateSteps(self, action_runner): 117 super(FacebookMobile2018Page, self).RunNavigateSteps(action_runner) 118 action_runner.WaitForJavaScriptCondition( 119 'document.getElementById("u_0_c") !== null &&' 120 'document.body.scrollHeight > window.innerHeight') 121 122 123class YoutubeMobile2018Page(TopRealWorldMobilePage): 124 """ Why: #3 (Alexa global) """ 125 BASE_NAME = 'youtube_mobile' 126 YEAR = '2018' 127 URL = 'http://m.youtube.com/watch?v=9hBpF_Zj4OA' 128 129 def __init__(self, 130 page_set, 131 name_suffix='', 132 extra_browser_args=None, 133 shared_page_state_class=shared_page_state.SharedMobilePageState): 134 super(YoutubeMobile2018Page, self).__init__( 135 page_set=page_set, 136 name_suffix=name_suffix, 137 extra_browser_args=extra_browser_args, 138 shared_page_state_class=shared_page_state_class) 139 140 def RunNavigateSteps(self, action_runner): 141 super(YoutubeMobile2018Page, self).RunNavigateSteps(action_runner) 142 action_runner.WaitForJavaScriptCondition( 143 'document.getElementById("player") !== null') 144 145 146class LinkedInMobile2018Page(TopRealWorldMobilePage): 147 """ Why: #12 (Alexa global),Public profile """ 148 BASE_NAME = 'linkedin_mobile' 149 YEAR = '2018' 150 URL = 'https://www.linkedin.com/in/linustorvalds' 151 152 def __init__(self, 153 page_set, 154 name_suffix='', 155 extra_browser_args=None, 156 shared_page_state_class=shared_page_state.SharedMobilePageState): 157 super(LinkedInMobile2018Page, self).__init__( 158 page_set=page_set, 159 name_suffix=name_suffix, 160 extra_browser_args=extra_browser_args, 161 shared_page_state_class=shared_page_state_class) 162 163 # Linkedin has expensive shader compilation so it can benefit from shader 164 # cache from reload. 165 def RunNavigateSteps(self, action_runner): 166 linkedin_login.LoginMobileAccount(action_runner, 'linkedin') 167 super(LinkedInMobile2018Page, self).RunNavigateSteps(action_runner) 168 action_runner.WaitForJavaScriptCondition( 169 'document.getElementById("profile-wrapper") !== null') 170 171 action_runner.ScrollPage() 172 173 super(LinkedInMobile2018Page, self).RunNavigateSteps(action_runner) 174 action_runner.WaitForJavaScriptCondition( 175 'document.getElementById("profile-wrapper") !== null') 176 177 178class YahooAnswersMobile2018Page(TopRealWorldMobilePage): 179 """ Why: #1 Alexa reference """ 180 BASE_NAME = 'yahoo_answers_mobile' 181 YEAR = '2018' 182 # pylint: disable=line-too-long 183 URL = 'https://ca.answers.yahoo.com/' 184 185 def __init__(self, 186 page_set, 187 name_suffix='', 188 extra_browser_args=None, 189 shared_page_state_class=shared_page_state.SharedMobilePageState): 190 super(YahooAnswersMobile2018Page, self).__init__( 191 page_set=page_set, 192 name_suffix=name_suffix, 193 extra_browser_args=extra_browser_args, 194 shared_page_state_class=shared_page_state_class) 195 196 def RunNavigateSteps(self, action_runner): 197 super(YahooAnswersMobile2018Page, self).RunNavigateSteps(action_runner) 198 action_runner.ScrollElement(selector='#page_scrollable') 199 200 201class GoogleNewsMobile2018Page(TopRealWorldMobilePage): 202 """ Why: Google News: accelerated scrolling version """ 203 BASE_NAME = 'google_news_mobile' 204 YEAR = '2018' 205 URL = 'https://news.google.com/' 206 207 def __init__(self, 208 page_set, 209 name_suffix='', 210 extra_browser_args=None, 211 shared_page_state_class=shared_page_state.SharedMobilePageState): 212 super(GoogleNewsMobile2018Page, self).__init__( 213 page_set=page_set, 214 name_suffix=name_suffix, 215 extra_browser_args=extra_browser_args, 216 shared_page_state_class=shared_page_state_class) 217 218 219class GoogleImageSearchMobile2018Page(TopRealWorldMobilePage): 220 """ Why: tough image case; top google properties """ 221 BASE_NAME = 'google_image_search_mobile' 222 YEAR = '2018' 223 URL = 'https://www.google.com/search?q=cats&tbm=isch' 224 225 def __init__(self, 226 page_set, 227 shared_page_state_class=shared_page_state.SharedPageState, 228 name_suffix='', 229 extra_browser_args=None): 230 super(GoogleImageSearchMobile2018Page, self).__init__( 231 page_set=page_set, 232 shared_page_state_class=shared_page_state_class, 233 name_suffix=name_suffix, 234 extra_browser_args=extra_browser_args) 235 236 237class AmazonNicolasCageMobile2018Page(TopRealWorldMobilePage): 238 """ 239 Why: #1 world commerce website by visits; #3 commerce in the US by time spent 240 """ 241 BASE_NAME = 'amazon_mobile' 242 YEAR = '2018' 243 URL = 'http://www.amazon.com/gp/aw/s/ref=is_box_?k=nicolas+cage' 244 245 def __init__(self, 246 page_set, 247 name_suffix='', 248 extra_browser_args=None, 249 shared_page_state_class=shared_page_state.SharedMobilePageState): 250 super(AmazonNicolasCageMobile2018Page, self).__init__( 251 page_set=page_set, 252 name_suffix=name_suffix, 253 extra_browser_args=extra_browser_args, 254 shared_page_state_class=shared_page_state_class) 255 256 257class WowwikiMobile2018Page(TopRealWorldMobilePage): 258 """Why: Mobile wiki.""" 259 BASE_NAME = 'wowwiki_mobile' 260 YEAR = '2018' 261 URL = 'http://www.wowwiki.com/World_of_Warcraft:_Mists_of_Pandaria' 262 263 def __init__(self, 264 page_set, 265 name_suffix='', 266 extra_browser_args=None, 267 shared_page_state_class=shared_page_state.SharedMobilePageState): 268 super(WowwikiMobile2018Page, self).__init__( 269 page_set=page_set, 270 name_suffix=name_suffix, 271 extra_browser_args=extra_browser_args, 272 shared_page_state_class=shared_page_state_class) 273 274 # Wowwiki has expensive shader compilation so it can benefit from shader 275 # cache from reload. 276 def RunNavigateSteps(self, action_runner): 277 super(WowwikiMobile2018Page, self).RunNavigateSteps(action_runner) 278 action_runner.ScrollPage() 279 super(WowwikiMobile2018Page, self).RunNavigateSteps(action_runner) 280 281 282class WikipediaDelayedScrollMobile2018Page(TopRealWorldMobilePage): 283 """Why: Wikipedia page with a delayed scroll start""" 284 BASE_NAME = 'wikipedia_delayed_scroll_start' 285 YEAR = '2018' 286 URL = 'http://en.wikipedia.org/wiki/Wikipedia' 287 288 def __init__(self, 289 page_set, 290 name_suffix='', 291 extra_browser_args=None, 292 shared_page_state_class=shared_page_state.SharedMobilePageState): 293 super(WikipediaDelayedScrollMobile2018Page, self).__init__( 294 page_set=page_set, 295 name_suffix=name_suffix, 296 extra_browser_args=extra_browser_args, 297 shared_page_state_class=shared_page_state_class) 298 299 def RunPageInteractions(self, action_runner): 300 action_runner.WaitForJavaScriptCondition( 301 'document.readyState == "complete"', timeout=30) 302 with action_runner.CreateGestureInteraction('ScrollAction'): 303 action_runner.ScrollPage() 304 305 306class BlogspotMobile2018Page(TopRealWorldMobilePage): 307 """Why: #11 (Alexa global), google property""" 308 BASE_NAME = 'blogspot_mobile' 309 YEAR = '2018' 310 URL = 'http://googlewebmastercentral.blogspot.com/' 311 312 313class WordpressMobile2018Page(TopRealWorldMobilePage): 314 """Why: #18 (Alexa global), Picked an interesting post""" 315 BASE_NAME = 'wordpress_mobile' 316 YEAR = '2018' 317 # pylint: disable=line-too-long 318 URL = 'http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks-for-august-2012/' 319 320 321class WikipediaMobile2018Page(TopRealWorldMobilePage): 322 """Why: #6 (Alexa) most visited worldwide, picked an interesting page""" 323 BASE_NAME = 'wikipedia_mobile' 324 YEAR = '2018' 325 URL = 'http://en.wikipedia.org/wiki/Wikipedia' 326 327 328class TwitterMobile2018Page(TopRealWorldMobilePage): 329 """Why: #8 (Alexa global), picked an interesting page""" 330 BASE_NAME = 'twitter_mobile' 331 YEAR = '2018' 332 URL = 'http://twitter.com/katyperry' 333 334 335class PinterestMobile2018Page(TopRealWorldMobilePage): 336 """Why: #37 (Alexa global).""" 337 BASE_NAME = 'pinterest_mobile' 338 YEAR = '2018' 339 URL = 'https://www.pinterest.com/search/pins/?q=flowers&rs=typed' 340 341 342class ESPNMobile2018Page(TopRealWorldMobilePage): 343 """Why: #1 sports.""" 344 BASE_NAME = 'espn_mobile' 345 YEAR = '2018' 346 URL = 'http://www.espn.com/' 347 348 349class ForecastIOMobile2018Page(TopRealWorldMobilePage): 350 """Why: crbug.com/231413""" 351 BASE_NAME = 'forecast.io_mobile' 352 YEAR = '2018' 353 URL = 'http://forecast.io' 354 355 356class GooglePlusMobile2018Page(TopRealWorldMobilePage): 357 """Why: Social; top Google property; Public profile; infinite scrolls.""" 358 BASE_NAME = 'google_plus_mobile' 359 YEAR = '2018' 360 # pylint: disable=line-too-long 361 URL = 'https://plus.google.com/app/basic/110031535020051778989/posts?source=apppromo' 362 363 364class AndroidPoliceMobile2018Page(TopRealWorldMobilePage): 365 """Why: crbug.com/242544""" 366 BASE_NAME = 'androidpolice_mobile' 367 YEAR = '2018' 368 # pylint: disable=line-too-long 369 URL = 'http://www.androidpolice.com/2012/10/03/rumor-evidence-mounts-that-an-lg-optimus-g-nexus-is-coming-along-with-a-nexus-phone-certification-program/' 370 371 372class GSPMobile2018Page(TopRealWorldMobilePage): 373 """Why: crbug.com/149958""" 374 BASE_NAME = 'gsp.ro_mobile' 375 YEAR = '2018' 376 URL = 'http://gsp.ro' 377 378 379class TheVergeMobile2018Page(TopRealWorldMobilePage): 380 """Why: Top tech blog""" 381 BASE_NAME = 'theverge_mobile' 382 YEAR = '2018' 383 URL = 'http://theverge.com' 384 385 386class DiggMobile2018Page(TopRealWorldMobilePage): 387 """Why: Top tech site""" 388 BASE_NAME = 'digg_mobile' 389 YEAR = '2018' 390 URL = 'http://digg.com/channel/digg-feature' 391 392 393class GoogleSearchMobile2018Page(TopRealWorldMobilePage): 394 """Why: Top Google property; a Google tab is often open""" 395 BASE_NAME = 'google_web_search_mobile' 396 YEAR = '2018' 397 URL = 'https://www.google.co.uk/search?hl=en&q=barack+obama&cad=h' 398 399 400class YahooNewsMobile2018Page(TopRealWorldMobilePage): 401 """Why: #1 news worldwide (Alexa global)""" 402 BASE_NAME = 'yahoo_news_mobile' 403 YEAR = '2018' 404 URL = 'http://news.yahoo.com' 405 406 407class CnnNewsMobile2018Page(TopRealWorldMobilePage): 408 """# Why: #2 news worldwide""" 409 BASE_NAME = 'cnn_mobile' 410 YEAR = '2018' 411 URL = 'http://www.cnn.com' 412 413 414class EbayMobile2018Page(TopRealWorldMobilePage): 415 """Why: #1 commerce website by time spent by users in US""" 416 BASE_NAME = 'ebay_mobile' 417 YEAR = '2018' 418 URL = 'https://m.ebay.com/' 419 420 421class BookingMobile2018Page(TopRealWorldMobilePage): 422 """Why: #1 Alexa recreation""" 423 BASE_NAME = 'booking.com_mobile' 424 YEAR = '2018' 425 # pylint: disable=line-too-long 426 URL = 'https://www.booking.com' 427 428 429class TechCrunchMobile2018Page(TopRealWorldMobilePage): 430 """Why: Top tech blog""" 431 BASE_NAME = 'techcrunch_mobile' 432 YEAR = '2018' 433 URL = 'http://techcrunch.com' 434 435 436class MLBMobile2018Page(TopRealWorldMobilePage): 437 """Why: #6 Alexa sports""" 438 BASE_NAME = 'mlb_mobile' 439 YEAR = '2018' 440 URL = 'http://mlb.com/' 441 442 443class SFGateMobile2018Page(TopRealWorldMobilePage): 444 """Why: #14 Alexa California""" 445 BASE_NAME = 'sfgate_mobile' 446 YEAR = '2018' 447 URL = 'http://www.sfgate.com/' 448 449 450class WorldJournalMobile2018Page(TopRealWorldMobilePage): 451 """Why: Non-latin character set""" 452 BASE_NAME = 'worldjournal_mobile' 453 YEAR = '2018' 454 URL = 'http://worldjournal.com/' 455 456 457class WSJMobile2018Page(TopRealWorldMobilePage): 458 """Why: #15 Alexa news""" 459 BASE_NAME = 'wsj_mobile' 460 YEAR = '2018' 461 URL = 'http://online.wsj.com/home-page' 462 463 464class DeviantArtMobile2018Page(TopRealWorldMobilePage): 465 """Why: Image-heavy mobile site""" 466 BASE_NAME = 'deviantart_mobile' 467 YEAR = '2018' 468 URL = 'http://www.deviantart.com/' 469 470 471class BaiduMobile2018Page(TopRealWorldMobilePage): 472 """Why: Top search engine""" 473 BASE_NAME = 'baidu_mobile' 474 YEAR = '2018' 475 # pylint: disable=line-too-long 476 URL = 'http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920' 477 478 479class BingMobile2018Page(TopRealWorldMobilePage): 480 """Why: Top search engine""" 481 BASE_NAME = 'bing_mobile' 482 YEAR = '2018' 483 URL = 'http://www.bing.com/search?q=sloths' 484 485 486class USATodayMobile2018Page(TopRealWorldMobilePage): 487 """Why: Good example of poor initial scrolling""" 488 BASE_NAME = 'usatoday_mobile' 489 YEAR = '2018' 490 URL = 'http://ftw.usatoday.com/' 491 492 493class FastPathSmoothMobilePage(TopRealWorldMobilePage): 494 ABSTRACT_STORY = True 495 TAGS = [story_tags.FASTPATH, story_tags.TOP_REAL_WORLD_MOBILE] 496 497 def __init__(self, 498 page_set, 499 name_suffix='', 500 extra_browser_args=None, 501 shared_page_state_class=shared_page_state.SharedMobilePageState): 502 super(FastPathSmoothMobilePage, self).__init__( 503 page_set=page_set, 504 name_suffix=name_suffix, 505 extra_browser_args=extra_browser_args, 506 shared_page_state_class=shared_page_state_class) 507 508 509class NYTimesMobile2018Page(FastPathSmoothMobilePage): 510 """Why: Top news site.""" 511 BASE_NAME = 'nytimes_mobile' 512 YEAR = '2018' 513 URL = 'http://nytimes.com/' 514 515 516class RedditMobile2018Page(FastPathSmoothMobilePage): 517 """Why: #5 Alexa news.""" 518 BASE_NAME = 'reddit_mobile' 519 YEAR = '2018' 520 URL = 'http://www.reddit.com/r/programming/comments/1g96ve' 521 522 523class BoingBoingMobile2018Page(FastPathSmoothMobilePage): 524 """Why: Problematic use of fixed position elements.""" 525 BASE_NAME = 'boingboing_mobile' 526 YEAR = '2018' 527 URL = 'http://www.boingboing.net' 528 529 530class SlashDotMobile2018Page(FastPathSmoothMobilePage): 531 """Why: crbug.com/169827""" 532 BASE_NAME = 'slashdot_mobile' 533 YEAR = '2018' 534 URL = 'http://slashdot.org' 535