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 from telemetry.page import page as page_module
      5 from telemetry.page import page_set as page_set_module
      6 
      7 class ToughPepperCasesPage(page_module.Page):
      8 
      9   def __init__(self, url, page_set):
     10     super(ToughPepperCasesPage, self).__init__(url=url, page_set=page_set)
     11 
     12   def RunSmoothness(self, action_runner):
     13     interaction = action_runner.BeginGestureInteraction(
     14         'ScrollAction', is_smooth=True)
     15     action_runner.ScrollPage()
     16     interaction.End()
     17 
     18 
     19 class Page1(ToughPepperCasesPage):
     20 
     21   """ Why: Simple pepper plugin for touch drawing """
     22 
     23   def __init__(self, page_set):
     24     super(Page1, self).__init__(
     25         url='file://tough_pepper_cases/simple_pepper_plugin.html',
     26         page_set=page_set)
     27 
     28   def RunSmoothness(self, action_runner):
     29     # Wait until the page and the plugin module are loaded.
     30     action_runner.WaitForJavaScriptCondition(
     31         'pageLoaded === true && moduleLoaded === true')
     32     interaction = action_runner.BeginGestureInteraction(
     33         'ScrollAction', is_smooth=True)
     34     action_runner.ScrollPage(
     35         use_touch=True,
     36         direction='up',
     37         top_start_ratio=0.3,
     38         left_start_ratio=0.3,
     39         speed_in_pixels_per_second=200,
     40         distance=500)
     41     interaction.End()
     42 
     43 class ToughPepperCasesPageSet(page_set_module.PageSet):
     44 
     45   """ Pepper latency test cases """
     46 
     47   def __init__(self):
     48     super(ToughPepperCasesPageSet, self).__init__()
     49 
     50     self.AddPage(Page1(self))
     51