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