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 telemetry
import benchmark
10 from telemetry
import page
as page_module
11 from telemetry
.page
import page_set
12 from telemetry
.page
import page_test
13 from telemetry
.value
import scalar
15 from metrics
import power
18 class _RobohornetProMeasurement(page_test
.PageTest
):
20 super(_RobohornetProMeasurement
, self
).__init
__()
21 self
._power
_metric
= None
23 def CustomizeBrowserOptions(self
, options
):
24 power
.PowerMetric
.CustomizeBrowserOptions(options
)
26 def WillStartBrowser(self
, platform
):
27 self
._power
_metric
= power
.PowerMetric(platform
)
29 def DidNavigateToPage(self
, page
, tab
):
30 self
._power
_metric
.Start(page
, tab
)
32 def ValidateAndMeasurePage(self
, page
, tab
, results
):
33 tab
.ExecuteJavaScript('ToggleRoboHornet()')
34 tab
.WaitForJavaScriptExpression(
35 'document.getElementById("results").innerHTML.indexOf("Total") != -1',
38 self
._power
_metric
.Stop(page
, tab
)
39 self
._power
_metric
.AddResults(tab
, results
)
41 result
= int(tab
.EvaluateJavaScript('stopTime - startTime'))
43 scalar
.ScalarValue(results
.current_page
, 'Total', 'ms', result
))
46 # We plan to remove this test because it doesn't give useful data, but
47 # we need to wait until Chrome OS can implement support for more helpful
49 @benchmark.Enabled('chromeos')
50 class RobohornetPro(benchmark
.Benchmark
):
51 """Milliseconds to complete the RoboHornetPro demo by Microsoft.
53 http://ie.microsoft.com/testdrive/performance/robohornetpro/
55 test
= _RobohornetProMeasurement
59 return 'robohornet_pro'
61 def CreatePageSet(self
, options
):
62 ps
= page_set
.PageSet(
63 archive_data_file
='../page_sets/data/robohornet_pro.json',
64 file_path
=os
.path
.abspath(__file__
),
65 bucket
=page_set
.PARTNER_BUCKET
)
66 ps
.AddUserStory(page_module
.Page(
67 'http://ie.microsoft.com/testdrive/performance/robohornetpro/',
69 # Measurement require use of real Date.now() for measurement.
70 make_javascript_deterministic
=False))