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 3 # found in the LICENSE file. 4 from telemetry.page import page as page_module 5 from telemetry.page import page_set as page_set_module 6 7 8 class ToughCompositorPage(page_module.Page): 9 10 def __init__(self, url, page_set): 11 super(ToughCompositorPage, self).__init__(url=url, page_set=page_set) 12 self.credentials_path = 'data/credentials.json' 13 self.user_agent_type = 'mobile' 14 self.archive_data_file = 'data/tough_compositor_cases.json' 15 16 def RunNavigateSteps(self, action_runner): 17 action_runner.NavigateToPage(self) 18 # TODO(epenner): Remove this wait (http://crbug.com/366933) 19 action_runner.Wait(5) 20 21 class ToughCompositorScrollPage(ToughCompositorPage): 22 23 def __init__(self, url, page_set): 24 super(ToughCompositorScrollPage, self).__init__(url=url, page_set=page_set) 25 26 def RunSmoothness(self, action_runner): 27 # Make the scroll longer to reduce noise. 28 interaction = action_runner.BeginGestureInteraction( 29 'ScrollAction', is_smooth=True) 30 action_runner.ScrollPage(direction='down', speed_in_pixels_per_second=300) 31 interaction.End() 32 33 class ToughCompositorWaitPage(ToughCompositorPage): 34 35 def __init__(self, url, page_set): 36 super(ToughCompositorWaitPage, self).__init__(url=url, page_set=page_set) 37 38 def RunSmoothness(self, action_runner): 39 # We scroll back and forth a few times to reduce noise in the tests. 40 action_runner.Wait(8) 41 42 43 class ToughCompositorCasesPageSet(page_set_module.PageSet): 44 45 """ Touch compositor sites """ 46 47 def __init__(self): 48 super(ToughCompositorCasesPageSet, self).__init__( 49 credentials_path='data/credentials.json', 50 user_agent_type='mobile', 51 archive_data_file='data/tough_compositor_cases.json', 52 bucket=page_set_module.PUBLIC_BUCKET) 53 54 scroll_urls_list = [ 55 # Why: Baseline CC scrolling page. A long page with only text. """ 56 'http://jsbin.com/pixavefe/1/quiet?CC_SCROLL_TEXT_ONLY', 57 # Why: Baseline JS scrolling page. A long page with only text. """ 58 'http://jsbin.com/wixadinu/2/quiet?JS_SCROLL_TEXT_ONLY', 59 # Why: Scroll by a large number of CC layers """ 60 'http://jsbin.com/yakagevo/1/quiet?CC_SCROLL_200_LAYER_GRID', 61 # Why: Scroll by a large number of JS layers """ 62 'http://jsbin.com/jevibahi/4/quiet?JS_SCROLL_200_LAYER_GRID', 63 ] 64 65 wait_urls_list = [ 66 # Why: CC Poster circle animates many layers """ 67 'http://jsbin.com/falefice/1/quiet?CC_POSTER_CIRCLE', 68 # Why: JS poster circle animates/commits many layers """ 69 'http://jsbin.com/giqafofe/1/quiet?JS_POSTER_CIRCLE', 70 # Why: JS invalidation does lots of uploads """ 71 'http://jsbin.com/beqojupo/1/quiet?JS_FULL_SCREEN_INVALIDATION', 72 ] 73 74 for url in scroll_urls_list: 75 self.AddPage(ToughCompositorScrollPage(url, self)) 76 77 for url in wait_urls_list: 78 self.AddPage(ToughCompositorWaitPage(url, self)) 79