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 import time | 4 import time |
5 import unittest | 5 import unittest |
6 | 6 |
7 from telemetry import decorators | 7 from telemetry import decorators |
8 from telemetry.page import page as page_module | 8 from telemetry.page import page as page_module |
9 from telemetry.page import legacy_page_test | 9 from telemetry.page import legacy_page_test |
10 from telemetry.testing import page_test_test_case | 10 from telemetry.testing import page_test_test_case |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 with action_runner.CreateGestureInteraction('ScrollAction'): | 104 with action_runner.CreateGestureInteraction('ScrollAction'): |
105 # Add 0.5s gap between when Gesture records are issued to when we actually | 105 # Add 0.5s gap between when Gesture records are issued to when we actually |
106 # scroll the page. | 106 # scroll the page. |
107 time.sleep(0.5) | 107 time.sleep(0.5) |
108 action_runner.ScrollPage() | 108 action_runner.ScrollPage() |
109 time.sleep(0.5) | 109 time.sleep(0.5) |
110 | 110 |
111 | 111 |
112 class SmoothGestureTest(page_test_test_case.PageTestTestCase): | 112 class SmoothGestureTest(page_test_test_case.PageTestTestCase): |
113 | 113 |
114 @decorators.Disabled('mac', # crbug.com/450171 | 114 @decorators.Disabled('chromeos') # crbug.com/483212 |
115 'chromeos') # crbug.com/483212 | |
116 @decorators.Isolated # Needed because of py_trace_event | 115 @decorators.Isolated # Needed because of py_trace_event |
117 def testSmoothGestureAdjusted(self): | 116 def testSmoothGestureAdjusted(self): |
118 ps = self.CreateEmptyPageSet() | 117 ps = self.CreateEmptyPageSet() |
119 ps.AddStory(ScrollingPage( | 118 ps.AddStory(ScrollingPage( |
120 'file://scrollable_page.html', ps, base_dir=ps.base_dir)) | 119 'file://scrollable_page.html', ps, base_dir=ps.base_dir)) |
121 models = [] | 120 models = [] |
122 tab_ids = [] | 121 tab_ids = [] |
123 class ScrollingGestureTestMeasurement(legacy_page_test.LegacyPageTest): | 122 class ScrollingGestureTestMeasurement(legacy_page_test.LegacyPageTest): |
124 def __init__(self): | 123 def __init__(self): |
125 # pylint: disable=bad-super-call | 124 # pylint: disable=bad-super-call |
(...skipping 23 matching lines...) Expand all Loading... |
149 adjusted_smooth_gesture = ( | 148 adjusted_smooth_gesture = ( |
150 sg_util.GetAdjustedInteractionIfContainGesture( | 149 sg_util.GetAdjustedInteractionIfContainGesture( |
151 timeline_model, smooth_record)) | 150 timeline_model, smooth_record)) |
152 # Test that the scroll gesture starts at at least 500ms after the start of | 151 # Test that the scroll gesture starts at at least 500ms after the start of |
153 # the interaction record and ends at at least 500ms before the end of | 152 # the interaction record and ends at at least 500ms before the end of |
154 # interaction record. | 153 # interaction record. |
155 self.assertLessEqual( | 154 self.assertLessEqual( |
156 500, adjusted_smooth_gesture.start - smooth_record.start) | 155 500, adjusted_smooth_gesture.start - smooth_record.start) |
157 self.assertLessEqual( | 156 self.assertLessEqual( |
158 500, smooth_record.end - adjusted_smooth_gesture.end) | 157 500, smooth_record.end - adjusted_smooth_gesture.end) |
OLD | NEW |