OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 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 | 4 |
| 5 from metrics import power |
5 from metrics import smoothness | 6 from metrics import smoothness |
6 from telemetry.page import page_measurement | 7 from telemetry.page import page_measurement |
7 | 8 |
| 9 |
8 class Smoothness(page_measurement.PageMeasurement): | 10 class Smoothness(page_measurement.PageMeasurement): |
9 def __init__(self): | 11 def __init__(self): |
10 super(Smoothness, self).__init__('smoothness') | 12 super(Smoothness, self).__init__('smoothness') |
11 self._metric = None | 13 self._smoothness_metric = None |
| 14 self._power_metric = None |
12 | 15 |
13 def CustomizeBrowserOptions(self, options): | 16 def CustomizeBrowserOptions(self, options): |
14 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') | 17 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') |
| 18 power.PowerMetric.CustomizeBrowserOptions(options) |
15 | 19 |
16 def CanRunForPage(self, page): | 20 def CanRunForPage(self, page): |
17 return hasattr(page, 'smoothness') | 21 return hasattr(page, 'smoothness') |
18 | 22 |
19 def WillRunActions(self, page, tab): | 23 def WillRunActions(self, page, tab): |
20 self._metric = smoothness.SmoothnessMetric() | 24 self._power_metric = power.PowerMetric() |
21 self._metric.Start(page, tab) | 25 self._power_metric.Start(page, tab) |
| 26 self._smoothness_metric = smoothness.SmoothnessMetric() |
| 27 self._smoothness_metric.Start(page, tab) |
22 | 28 |
23 def DidRunAction(self, page, tab, action): | 29 def DidRunAction(self, page, tab, action): |
24 self._metric.AddActionToIncludeInMetric(action) | 30 self._smoothness_metric.AddActionToIncludeInMetric(action) |
25 | 31 |
26 def DidRunActions(self, page, tab): | 32 def DidRunActions(self, page, tab): |
27 self._metric.Stop(page, tab) | 33 self._power_metric.Stop(page, tab) |
| 34 self._smoothness_metric.Stop(page, tab) |
28 | 35 |
29 def MeasurePage(self, page, tab, results): | 36 def MeasurePage(self, page, tab, results): |
30 self._metric.AddResults(tab, results) | 37 self._power_metric.AddResults(tab, results) |
| 38 self._smoothness_metric.AddResults(tab, results) |
OLD | NEW |