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 telemetry
.page
import page_test
7 from measurements
import smoothness_controller
8 from metrics
import power
11 class Smoothness(page_test
.PageTest
):
13 super(Smoothness
, self
).__init
__()
14 self
._power
_metric
= None
15 self
._smoothness
_controller
= None
18 def CustomizeBrowserOptions(cls
, options
):
19 options
.AppendExtraBrowserArgs('--enable-gpu-benchmarking')
20 options
.AppendExtraBrowserArgs('--touch-events=enabled')
21 options
.AppendExtraBrowserArgs('--running-performance-benchmark')
22 power
.PowerMetric
.CustomizeBrowserOptions(options
)
24 def WillStartBrowser(self
, platform
):
25 self
._power
_metric
= power
.PowerMetric(platform
)
27 def WillNavigateToPage(self
, page
, tab
):
28 self
._power
_metric
.Start(page
, tab
)
29 self
._smoothness
_controller
= smoothness_controller
.SmoothnessController()
30 self
._smoothness
_controller
.SetUp(page
, tab
)
32 def WillRunActions(self
, page
, tab
):
33 self
._smoothness
_controller
.Start(tab
)
35 def DidRunActions(self
, page
, tab
):
36 self
._power
_metric
.Stop(page
, tab
)
37 self
._smoothness
_controller
.Stop(tab
)
39 def ValidateAndMeasurePage(self
, page
, tab
, results
):
40 self
._power
_metric
.AddResults(tab
, results
)
41 self
._smoothness
_controller
.AddResults(tab
, results
)
43 def CleanUpAfterPage(self
, page
, tab
):
44 if self
._power
_metric
:
45 self
._power
_metric
.Stop(page
, tab
)
46 if self
._smoothness
_controller
:
47 self
._smoothness
_controller
.CleanUp(tab
)