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