1 # Copyright 2012 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 """Runs Microsoft's RoboHornet Pro benchmark."""
9 from metrics
import power
10 from telemetry
import benchmark
11 from telemetry
.page
import page_set
12 from telemetry
.page
import page_test
13 from telemetry
.value
import scalar
16 class _RobohornetProMeasurement(page_test
.PageTest
):
18 super(_RobohornetProMeasurement
, self
).__init
__()
19 self
._power
_metric
= None
21 def CustomizeBrowserOptions(self
, options
):
22 power
.PowerMetric
.CustomizeBrowserOptions(options
)
24 def WillStartBrowser(self
, platform
):
25 self
._power
_metric
= power
.PowerMetric(platform
)
27 def DidNavigateToPage(self
, page
, tab
):
28 self
._power
_metric
.Start(page
, tab
)
30 def ValidateAndMeasurePage(self
, page
, tab
, results
):
31 tab
.ExecuteJavaScript('ToggleRoboHornet()')
32 tab
.WaitForJavaScriptExpression(
33 'document.getElementById("results").innerHTML.indexOf("Total") != -1',
36 self
._power
_metric
.Stop(page
, tab
)
37 self
._power
_metric
.AddResults(tab
, results
)
39 result
= int(tab
.EvaluateJavaScript('stopTime - startTime'))
41 scalar
.ScalarValue(results
.current_page
, 'Total', 'ms', result
))
45 class RobohornetPro(benchmark
.Benchmark
):
46 test
= _RobohornetProMeasurement
48 def CreatePageSet(self
, options
):
49 ps
= page_set
.PageSet(
50 archive_data_file
='../page_sets/data/robohornet_pro.json',
51 # Measurement require use of real Date.now() for measurement.
52 make_javascript_deterministic
=False,
53 file_path
=os
.path
.abspath(__file__
))
54 ps
.AddPageWithDefaultRunNavigate(
55 'http://ie.microsoft.com/testdrive/performance/robohornetpro/')