OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 unittest | 4 import unittest |
5 import random | 5 import random |
6 | 6 |
7 from metrics import smoothness | 7 from metrics import smoothness |
8 from metrics.gpu_rendering_stats import GpuRenderingStats | 8 from metrics.gpu_rendering_stats import GpuRenderingStats |
9 from telemetry.page import page | 9 from telemetry.page import page |
10 from telemetry.page.page_measurement_results import PageMeasurementResults | 10 from telemetry.page.page_measurement_results import PageMeasurementResults |
11 from telemetry.core.chrome.tracing_backend import RawTraceResultImpl | 11 from telemetry.core.backends.chrome.tracing_backend import RawTraceResultImpl |
12 from telemetry.core.chrome.trace_result import TraceResult | 12 from telemetry.core.backends.chrome.trace_result import TraceResult |
13 | 13 |
14 class MockTimer(object): | 14 class MockTimer(object): |
15 """ An instance of this class is used as a global timer to generate | 15 """ An instance of this class is used as a global timer to generate |
16 random durations for stats and consistent timestamps for all mock trace | 16 random durations for stats and consistent timestamps for all mock trace |
17 events. | 17 events. |
18 """ | 18 """ |
19 def __init__(self): | 19 def __init__(self): |
20 self.microseconds = 0 | 20 self.microseconds = 0 |
21 | 21 |
22 def Advance(self, low = 0, high = 100000): | 22 def Advance(self, low = 0, high = 100000): |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 self.assertAlmostEquals( | 299 self.assertAlmostEquals( |
300 round(rs['totalTouchUILatency'] / rs['touchUICount'] * 1000.0, 3), | 300 round(rs['totalTouchUILatency'] / rs['touchUICount'] * 1000.0, 3), |
301 res.page_results[0]['average_touch_ui_latency'].value) | 301 res.page_results[0]['average_touch_ui_latency'].value) |
302 self.assertAlmostEquals( | 302 self.assertAlmostEquals( |
303 round(rs['totalTouchAckedLatency'] / rs['touchAckedCount'] * 1000.0, 3), | 303 round(rs['totalTouchAckedLatency'] / rs['touchAckedCount'] * 1000.0, 3), |
304 res.page_results[0]['average_touch_acked_latency'].value) | 304 res.page_results[0]['average_touch_acked_latency'].value) |
305 self.assertAlmostEquals( | 305 self.assertAlmostEquals( |
306 round(rs['totalScrollUpdateLatency'] / rs['scrollUpdateCount'] * 1000.0, | 306 round(rs['totalScrollUpdateLatency'] / rs['scrollUpdateCount'] * 1000.0, |
307 3), | 307 3), |
308 res.page_results[0]['average_scroll_update_latency'].value) | 308 res.page_results[0]['average_scroll_update_latency'].value) |
OLD | NEW |