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