Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / tools / perf / page_sets / tough_scrolling_cases.py
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 ToughScrollingCasesPage(page_module.Page):
9
10   def __init__(self, url, page_set):
11     super(ToughScrollingCasesPage, self).__init__(url=url, page_set=page_set)
12
13   def RunSmoothness(self, action_runner):
14     interaction = action_runner.BeginGestureInteraction(
15         'ScrollAction', is_smooth=True)
16     action_runner.ScrollPage()
17     interaction.End()
18
19 class ToughFastScrollingCasesPage(page_module.Page):
20
21   def __init__(self, url, name, speed_in_pixels_per_second, page_set):
22     super(ToughFastScrollingCasesPage, self).__init__(
23       url=url,
24       page_set=page_set,
25       name=name,
26       labels=['fastscrolling'])
27     self.speed_in_pixels_per_second = speed_in_pixels_per_second
28
29   def RunSmoothness(self, action_runner):
30     interaction = action_runner.BeginGestureInteraction(
31         'ScrollAction', is_smooth=True)
32     action_runner.ScrollPage(
33       direction='down',
34       speed_in_pixels_per_second=self.speed_in_pixels_per_second)
35     interaction.End()
36
37 class ToughScrollingCasesPageSet(page_set_module.PageSet):
38
39   """
40   Description: A collection of difficult scrolling tests
41   """
42
43   def __init__(self):
44     super(ToughScrollingCasesPageSet, self).__init__()
45
46     urls_list = [
47       'file://tough_scrolling_cases/background_fixed.html',
48       'file://tough_scrolling_cases/cust_scrollbar.html',
49       'file://tough_scrolling_cases/div_scrolls.html',
50       'file://tough_scrolling_cases/fixed_nonstacking.html',
51       'file://tough_scrolling_cases/fixed_stacking.html',
52       'file://tough_scrolling_cases/iframe_scrolls.html',
53       'file://tough_scrolling_cases/simple.html',
54       'file://tough_scrolling_cases/wheel_body_prevdefault.html',
55       'file://tough_scrolling_cases/wheel_div_prevdefault.html'
56     ]
57
58     for url in urls_list:
59       self.AddPage(ToughScrollingCasesPage(url, self))
60
61     fast_scrolling_page_name_list = [
62       'text',
63       'canvas'
64     ]
65
66     fast_scrolling_speed_list = [
67       5000, 10000, 15000, 20000, 30000, 40000, 50000, 60000, 75000, 90000
68     ]
69
70     for name in fast_scrolling_page_name_list:
71       for speed in fast_scrolling_speed_list:
72         self.AddPage(ToughFastScrollingCasesPage(
73           'file://tough_scrolling_cases/' + name + '.html',
74           name + '_' + str(speed).zfill(5) + '_pixels_per_second',
75           speed,
76           self))