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 measurements import smooth_gesture_util as sg_util | 7 from measurements import smooth_gesture_util as sg_util |
8 from telemetry.core.platform import tracing_category_filter | 8 from telemetry.core.platform import tracing_category_filter |
9 from telemetry.core.platform import tracing_options | 9 from telemetry.core.platform import tracing_options |
10 from telemetry.page import page as page_module | 10 from telemetry.page import page as page_module |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 | 113 |
114 class SmoothGestureTest(page_test_test_case.PageTestTestCase): | 114 class SmoothGestureTest(page_test_test_case.PageTestTestCase): |
115 def testSmoothGestureAdjusted(self): | 115 def testSmoothGestureAdjusted(self): |
116 ps = self.CreateEmptyPageSet() | 116 ps = self.CreateEmptyPageSet() |
117 ps.AddPage(ScrollingPage( | 117 ps.AddPage(ScrollingPage( |
118 'file://scrollable_page.html', ps, base_dir=ps.base_dir)) | 118 'file://scrollable_page.html', ps, base_dir=ps.base_dir)) |
119 models = [] | 119 models = [] |
120 tab_ids = [] | 120 tab_ids = [] |
121 class ScrollingGestureTestMeasurement(page_test.PageTest): | 121 class ScrollingGestureTestMeasurement(page_test.PageTest): |
122 def __init__(self): | 122 def __init__(self): |
123 # pylint: disable=E1003 | |
nednguyen
2014/11/19 19:44:16
Can you change this to disable=bad-super-call inst
ernstm
2014/11/19 20:02:44
Done.
| |
123 super(ScrollingGestureTestMeasurement, self).__init__( | 124 super(ScrollingGestureTestMeasurement, self).__init__( |
124 'RunSmoothness', False) | 125 'RunSmoothness', False) |
125 | 126 |
126 def WillRunActions(self, _page, tab): | 127 def WillRunActions(self, _page, tab): |
127 options = tracing_options.TracingOptions() | 128 options = tracing_options.TracingOptions() |
128 options.enable_chrome_trace = True | 129 options.enable_chrome_trace = True |
129 tab.browser.platform.tracing_controller.Start( | 130 tab.browser.platform.tracing_controller.Start( |
130 options, tracing_category_filter.TracingCategoryFilter()) | 131 options, tracing_category_filter.TracingCategoryFilter()) |
131 | 132 |
132 def DidRunActions(self, _page, tab): | 133 def DidRunActions(self, _page, tab): |
(...skipping 13 matching lines...) Expand all Loading... | |
146 adjusted_smooth_gesture = ( | 147 adjusted_smooth_gesture = ( |
147 sg_util.GetAdjustedInteractionIfContainGesture( | 148 sg_util.GetAdjustedInteractionIfContainGesture( |
148 timeline_model, smooth_record)) | 149 timeline_model, smooth_record)) |
149 # Test that the scroll gesture starts at at least 500ms after the start of | 150 # Test that the scroll gesture starts at at least 500ms after the start of |
150 # the interaction record and ends at at least 500ms before the end of | 151 # the interaction record and ends at at least 500ms before the end of |
151 # interaction record. | 152 # interaction record. |
152 self.assertLessEqual( | 153 self.assertLessEqual( |
153 500, adjusted_smooth_gesture.start - smooth_record.start) | 154 500, adjusted_smooth_gesture.start - smooth_record.start) |
154 self.assertLessEqual( | 155 self.assertLessEqual( |
155 500, smooth_record.end - adjusted_smooth_gesture.end) | 156 500, smooth_record.end - adjusted_smooth_gesture.end) |
OLD | NEW |