| 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 | 4 |
| 5 from measurements import PageTestMeasurement |
| 6 from measurements import smoothness_controller |
| 5 from metrics import power | 7 from metrics import power |
| 6 from measurements import smoothness_controller | |
| 7 from telemetry.page import page_test | |
| 8 | 8 |
| 9 | 9 class Smoothness(PageTestMeasurement): |
| 10 class Smoothness(page_test.PageTest): | |
| 11 def __init__(self): | 10 def __init__(self): |
| 12 super(Smoothness, self).__init__('RunSmoothness') | 11 super(Smoothness, self).__init__('RunSmoothness') |
| 13 self._power_metric = None | 12 self._power_metric = None |
| 14 self._smoothness_controller = None | 13 self._smoothness_controller = None |
| 15 | 14 |
| 16 @classmethod | 15 @classmethod |
| 17 def CustomizeBrowserOptions(cls, options): | 16 def CustomizeBrowserOptionsClass(cls, options): |
| 18 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') | 17 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') |
| 19 options.AppendExtraBrowserArgs('--touch-events=enabled') | 18 options.AppendExtraBrowserArgs('--touch-events=enabled') |
| 20 options.AppendExtraBrowserArgs('--running-performance-benchmark') | 19 options.AppendExtraBrowserArgs('--running-performance-benchmark') |
| 21 power.PowerMetric.CustomizeBrowserOptions(options) | 20 power.PowerMetric.CustomizeBrowserOptions(options) |
| 22 | 21 |
| 22 def CustomizeBrowserOptions(self, options): |
| 23 super(Smoothness, self).CustomizeBrowserOptions(options) |
| 24 Smoothness.CustomizeBrowserOptionsClass(options) |
| 25 |
| 23 def WillStartBrowser(self, platform): | 26 def WillStartBrowser(self, platform): |
| 24 self._power_metric = power.PowerMetric(platform) | 27 self._power_metric = power.PowerMetric(platform) |
| 25 | 28 |
| 26 def WillNavigateToPage(self, page, tab): | 29 def WillNavigateToPage(self, page, tab): |
| 27 self._power_metric.Start(page, tab) | 30 self._power_metric.Start(page, tab) |
| 28 self._smoothness_controller = smoothness_controller.SmoothnessController() | 31 self._smoothness_controller = smoothness_controller.SmoothnessController() |
| 29 self._smoothness_controller.SetUp(page, tab) | 32 self._smoothness_controller.SetUp(page, tab) |
| 30 | 33 |
| 31 def WillRunActions(self, page, tab): | 34 def WillRunActions(self, page, tab): |
| 32 self._smoothness_controller.Start(tab) | 35 self._smoothness_controller.Start(tab) |
| 33 | 36 |
| 34 def DidRunActions(self, page, tab): | 37 def DidRunActions(self, page, tab): |
| 35 self._power_metric.Stop(page, tab) | 38 self._power_metric.Stop(page, tab) |
| 36 self._smoothness_controller.Stop(tab) | 39 self._smoothness_controller.Stop(tab) |
| 37 | 40 |
| 38 def ValidateAndMeasurePage(self, page, tab, results): | 41 def ValidateAndMeasurePage(self, page, tab, results): |
| 42 super(Smoothness, self).ValidateAndMeasurePage(page, tab, results) |
| 39 self._power_metric.AddResults(tab, results) | 43 self._power_metric.AddResults(tab, results) |
| 40 self._smoothness_controller.AddResults(tab, results) | 44 self._smoothness_controller.AddResults(tab, results) |
| 41 | 45 |
| 42 def CleanUpAfterPage(self, page, tab): | 46 def CleanUpAfterPage(self, page, tab): |
| 43 if self._power_metric: | 47 if self._power_metric: |
| 44 self._power_metric.Stop(page, tab) | 48 self._power_metric.Stop(page, tab) |
| 45 if self._smoothness_controller: | 49 if self._smoothness_controller: |
| 46 self._smoothness_controller.CleanUp(tab) | 50 self._smoothness_controller.CleanUp(tab) |
| OLD | NEW |