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
3 # found in the LICENSE file.
5 from metrics
import power
6 from measurements
import smoothness_controller
7 from telemetry
.page
import page_test
10 class Smoothness(page_test
.PageTest
):
12 super(Smoothness
, self
).__init
__('RunSmoothness')
13 self
._power
_metric
= None
14 self
._smoothness
_controller
= None
17 def CustomizeBrowserOptions(cls
, options
):
18 options
.AppendExtraBrowserArgs('--enable-gpu-benchmarking')
19 options
.AppendExtraBrowserArgs('--touch-events=enabled')
20 options
.AppendExtraBrowserArgs('--running-performance-benchmark')
21 power
.PowerMetric
.CustomizeBrowserOptions(options
)
23 def WillStartBrowser(self
, platform
):
24 self
._power
_metric
= power
.PowerMetric(platform
)
26 def WillNavigateToPage(self
, page
, tab
):
27 self
._power
_metric
.Start(page
, tab
)
28 self
._smoothness
_controller
= smoothness_controller
.SmoothnessController()
29 self
._smoothness
_controller
.SetUp(page
, tab
)
31 def WillRunActions(self
, page
, tab
):
32 self
._smoothness
_controller
.Start(tab
)
34 def DidRunActions(self
, page
, tab
):
35 self
._power
_metric
.Stop(page
, tab
)
36 self
._smoothness
_controller
.Stop(tab
)
38 def ValidateAndMeasurePage(self
, page
, tab
, results
):
39 self
._power
_metric
.AddResults(tab
, results
)
40 self
._smoothness
_controller
.AddResults(tab
, results
)
42 def CleanUpAfterPage(self
, page
, tab
):
43 if self
._power
_metric
:
44 self
._power
_metric
.Stop(page
, tab
)
45 if self
._smoothness
_controller
:
46 self
._smoothness
_controller
.CleanUp(tab
)