| 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_measurement |
| 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 |
| 11 from telemetry.value import scalar |
| 10 from telemetry.web_perf import timeline_interaction_record as tir_module | 12 from telemetry.web_perf import timeline_interaction_record as tir_module |
| 11 from telemetry.web_perf.metrics import smoothness | 13 from telemetry.web_perf.metrics import smoothness |
| 12 | 14 |
| 13 | 15 |
| 14 RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions' | 16 RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions' |
| 15 | 17 |
| 16 | 18 |
| 17 class MissingDisplayFrameRateError(page_measurement.MeasurementFailure): | 19 class MissingDisplayFrameRateError(page_measurement.MeasurementFailure): |
| 18 def __init__(self, name): | 20 def __init__(self, name): |
| 19 super(MissingDisplayFrameRateError, self).__init__( | 21 super(MissingDisplayFrameRateError, self).__init__( |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 # Create an interaction_record for this legacy measurement. Since we don't | 90 # Create an interaction_record for this legacy measurement. Since we don't |
| 89 # wrap the results that is sent to smoothnes metric, the logical_name will | 91 # wrap the results that is sent to smoothnes metric, the logical_name will |
| 90 # not be used. | 92 # not be used. |
| 91 smoothness_metric = smoothness.SmoothnessMetric() | 93 smoothness_metric = smoothness.SmoothnessMetric() |
| 92 smoothness_metric.AddResults( | 94 smoothness_metric.AddResults( |
| 93 self._timeline_model, renderer_thread, smooth_records, results) | 95 self._timeline_model, renderer_thread, smooth_records, results) |
| 94 if tab.browser.platform.IsRawDisplayFrameRateSupported(): | 96 if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
| 95 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): | 97 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): |
| 96 if r.value is None: | 98 if r.value is None: |
| 97 raise MissingDisplayFrameRateError(r.name) | 99 raise MissingDisplayFrameRateError(r.name) |
| 98 results.Add(r.name, r.unit, r.value) | 100 if isinstance(r.value, list): |
| 101 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
| 102 results.current_page, r.name, r.unit, r.value)) |
| 103 else: |
| 104 results.AddValue(scalar.ScalarValue( |
| 105 results.current_page, r.name, r.unit, r.value)) |
| 99 | 106 |
| 100 def CleanUp(self, tab): | 107 def CleanUp(self, tab): |
| 101 if tab.browser.platform.IsRawDisplayFrameRateSupported(): | 108 if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
| 102 tab.browser.platform.StopRawDisplayFrameRateMeasurement() | 109 tab.browser.platform.StopRawDisplayFrameRateMeasurement() |
| 103 if tab.browser.is_tracing_running: | 110 if tab.browser.is_tracing_running: |
| 104 tab.browser.StopTracing() | 111 tab.browser.StopTracing() |
| OLD | NEW |