Port Android relocation packer to chromium build
[chromium-blink-merge.git] / tools / perf / benchmarks / robohornet_pro.py
blobf299089cf938b51577b52db1b6d64afa45c8dda9
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."""
7 import os
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):
19 def __init__(self):
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',
36 600)
38 self._power_metric.Stop(page, tab)
39 self._power_metric.AddResults(tab, results)
41 result = int(tab.EvaluateJavaScript('stopTime - startTime'))
42 results.AddValue(
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
48 # benchmarks.
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/
54 """
55 test = _RobohornetProMeasurement
57 @classmethod
58 def Name(cls):
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/',
68 ps, ps.base_dir,
69 # Measurement require use of real Date.now() for measurement.
70 make_javascript_deterministic=False))
71 return ps