OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 from telemetry.internal.actions import page_action |
4 from telemetry.page import page as page_module | 5 from telemetry.page import page as page_module |
5 from telemetry.page import page_set as page_set_module | 6 from telemetry.page import page_set as page_set_module |
6 | 7 |
7 | 8 |
8 class ToughFastScrollingCasesPage(page_module.Page): | 9 class ToughFastScrollingCasesPage(page_module.Page): |
9 | 10 |
10 def __init__(self, url, name, speed_in_pixels_per_second, page_set): | 11 def __init__(self, url, name, speed_in_pixels_per_second, page_set, |
| 12 synthetic_gesture_source): |
11 super(ToughFastScrollingCasesPage, self).__init__( | 13 super(ToughFastScrollingCasesPage, self).__init__( |
12 url=url, | 14 url=url, |
13 page_set=page_set, | 15 page_set=page_set, |
14 name=name) | 16 name=name) |
15 self.speed_in_pixels_per_second = speed_in_pixels_per_second | 17 self.speed_in_pixels_per_second = speed_in_pixels_per_second |
| 18 self.synthetic_gesture_source = synthetic_gesture_source |
16 | 19 |
17 def RunPageInteractions(self, action_runner): | 20 def RunPageInteractions(self, action_runner): |
18 with action_runner.CreateGestureInteraction('ScrollAction'): | 21 with action_runner.CreateGestureInteraction('ScrollAction'): |
19 action_runner.ScrollPage( | 22 action_runner.ScrollPage( |
20 direction='down', | 23 direction='down', |
21 speed_in_pixels_per_second=self.speed_in_pixels_per_second) | 24 speed_in_pixels_per_second=self.speed_in_pixels_per_second, |
| 25 synthetic_gesture_source=self.synthetic_gesture_source) |
22 | 26 |
23 class ToughScrollingCasesPageSet(page_set_module.PageSet): | 27 class ToughScrollingCasesPageSet(page_set_module.PageSet): |
24 | 28 |
25 """ | 29 """ |
26 Description: A collection of difficult scrolling tests | 30 Description: A collection of difficult scrolling tests |
27 """ | 31 """ |
28 | 32 |
29 def __init__(self): | 33 def __init__(self): |
30 super(ToughScrollingCasesPageSet, self).__init__() | 34 super(ToughScrollingCasesPageSet, self).__init__() |
31 | 35 |
32 fast_scrolling_page_name_list = [ | 36 fast_scrolling_page_name_list = [ |
33 'text', | 37 'text', |
| 38 'text_hover', |
34 'canvas' | 39 'canvas' |
35 ] | 40 ] |
36 | 41 |
37 fast_scrolling_speed_list = [ | 42 fast_scrolling_speed_list = [ |
38 5000, 10000, 15000, 20000, 30000, 40000, 50000, 60000, 75000, 90000 | 43 5000, 10000, 15000, 20000, 30000, 40000, 50000, 60000, 75000, 90000 |
39 ] | 44 ] |
40 | 45 |
41 for name in fast_scrolling_page_name_list: | 46 for name in fast_scrolling_page_name_list: |
42 for speed in fast_scrolling_speed_list: | 47 for speed in fast_scrolling_speed_list: |
| 48 synthetic_gesture_source = page_action.GESTURE_SOURCE_DEFAULT |
| 49 if "hover" in name: |
| 50 synthetic_gesture_source = page_action.GESTURE_SOURCE_MOUSE |
43 self.AddUserStory(ToughFastScrollingCasesPage( | 51 self.AddUserStory(ToughFastScrollingCasesPage( |
44 'file://tough_scrolling_cases/' + name + '.html', | 52 'file://tough_scrolling_cases/' + name + '.html', |
45 name + '_' + str(speed).zfill(5) + '_pixels_per_second', | 53 name + '_' + str(speed).zfill(5) + '_pixels_per_second', |
46 speed, | 54 speed, |
47 self)) | 55 self, |
| 56 synthetic_gesture_source)) |
OLD | NEW |