| 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 sys | 4 import sys |
| 5 | 5 |
| 6 from measurements import smooth_gesture_util | 6 from measurements import smooth_gesture_util |
| 7 from telemetry.timeline.model import TimelineModel | 7 from telemetry.timeline.model import TimelineModel |
| 8 from telemetry.page import page_measurement | 8 from telemetry.page import page_test |
| 9 from telemetry.page.actions import action_runner | 9 from telemetry.page.actions import action_runner |
| 10 from telemetry.value import list_of_scalar_values | 10 from telemetry.value import list_of_scalar_values |
| 11 from telemetry.value import scalar | 11 from telemetry.value import scalar |
| 12 from telemetry.web_perf import timeline_interaction_record as tir_module | 12 from telemetry.web_perf import timeline_interaction_record as tir_module |
| 13 from telemetry.web_perf.metrics import smoothness | 13 from telemetry.web_perf.metrics import smoothness |
| 14 | 14 |
| 15 | 15 |
| 16 RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions' | 16 RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions' |
| 17 | 17 |
| 18 # Descriptions for results from platform.GetRawDisplayFrameRateMeasurements(). | 18 # Descriptions for results from platform.GetRawDisplayFrameRateMeasurements(). |
| 19 DESCRIPTIONS = { | 19 DESCRIPTIONS = { |
| 20 'avg_surface_fps': 'Average frames per second as measured by the ' | 20 'avg_surface_fps': 'Average frames per second as measured by the ' |
| 21 'platform\'s SurfaceFlinger.' | 21 'platform\'s SurfaceFlinger.' |
| 22 } | 22 } |
| 23 | 23 |
| 24 | 24 |
| 25 class MissingDisplayFrameRateError(page_measurement.MeasurementFailure): | 25 class MissingDisplayFrameRateError(page_test.MeasurementFailure): |
| 26 def __init__(self, name): | 26 def __init__(self, name): |
| 27 super(MissingDisplayFrameRateError, self).__init__( | 27 super(MissingDisplayFrameRateError, self).__init__( |
| 28 'Missing display frame rate metrics: ' + name) | 28 'Missing display frame rate metrics: ' + name) |
| 29 | 29 |
| 30 class SmoothnessController(object): | 30 class SmoothnessController(object): |
| 31 def __init__(self): | 31 def __init__(self): |
| 32 self._timeline_model = None | 32 self._timeline_model = None |
| 33 self._tracing_timeline_data = None | 33 self._tracing_timeline_data = None |
| 34 self._interaction = None | 34 self._interaction = None |
| 35 | 35 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 else: | 112 else: |
| 113 results.AddValue(scalar.ScalarValue( | 113 results.AddValue(scalar.ScalarValue( |
| 114 results.current_page, r.name, r.unit, r.value, | 114 results.current_page, r.name, r.unit, r.value, |
| 115 description=DESCRIPTIONS.get(r.name))) | 115 description=DESCRIPTIONS.get(r.name))) |
| 116 | 116 |
| 117 def CleanUp(self, tab): | 117 def CleanUp(self, tab): |
| 118 if tab.browser.platform.IsRawDisplayFrameRateSupported(): | 118 if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
| 119 tab.browser.platform.StopRawDisplayFrameRateMeasurement() | 119 tab.browser.platform.StopRawDisplayFrameRateMeasurement() |
| 120 if tab.browser.is_tracing_running: | 120 if tab.browser.is_tracing_running: |
| 121 tab.browser.StopTracing() | 121 tab.browser.StopTracing() |
| OLD | NEW |