Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: tools/perf/benchmarks/html5gaming.py

Issue 714273004: mac: Expose keychain access frequency to Telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mock_keychain_sleep
Patch Set: Add a common subclass to measurements. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Impact HTML5 Gaming benchmark. 5 """Impact HTML5 Gaming benchmark.
6 6
7 Tests one very specific use case: smooth running games rendered with the 7 Tests one very specific use case: smooth running games rendered with the
8 <canvas> element. The score for the HTML5-Benchmark takes the total time the 8 <canvas> element. The score for the HTML5-Benchmark takes the total time the
9 browser spent rendering frames (formula is 1000000/(sqrt(totalTime) + lagTime * 9 browser spent rendering frames (formula is 1000000/(sqrt(totalTime) + lagTime *
10 0.1)). The benchmark automatically runs at a reasonable screen size. Final 10 0.1)). The benchmark automatically runs at a reasonable screen size. Final
11 score is a indicator for the browser's ability to smoothly run HTML5 games.""" 11 score is a indicator for the browser's ability to smoothly run HTML5 games."""
12 12
13 import os 13 import os
14 14
15 from measurements import PageTestMeasurement
15 from telemetry import benchmark 16 from telemetry import benchmark
16 from telemetry.page import page_set 17 from telemetry.page import page_set
17 from telemetry.page import page_test
18 from telemetry.value import scalar 18 from telemetry.value import scalar
19 19
20 20
21 class _HTML5GamingMeasurement(page_test.PageTest): 21 class _HTML5GamingMeasurement(PageTestMeasurement):
22 def ValidateAndMeasurePage(self, _, tab, results): 22 def ValidateAndMeasurePage(self, page, tab, results):
23 tab.ExecuteJavaScript('benchmark();') 23 tab.ExecuteJavaScript('benchmark();')
24 # Default value of score element is 87485, its value is updated with actual 24 # Default value of score element is 87485, its value is updated with actual
25 # score when test finish. 25 # score when test finish.
26 tab.WaitForJavaScriptExpression( 26 tab.WaitForJavaScriptExpression(
27 'document.getElementById("score").innerHTML != "87485"', 200) 27 'document.getElementById("score").innerHTML != "87485"', 200)
28 result = int(tab.EvaluateJavaScript( 28 result = int(tab.EvaluateJavaScript(
29 'document.getElementById("score").innerHTML')) 29 'document.getElementById("score").innerHTML'))
30 results.AddValue( 30 results.AddValue(
31 scalar.ScalarValue(results.current_page, 'Score', 'score', result)) 31 scalar.ScalarValue(results.current_page, 'Score', 'score', result))
32 32 super(_HTML5GamingMeasurement, self).ValidateAndMeasurePage(
33 page, tab, results)
33 34
34 35
35 @benchmark.Disabled 36 @benchmark.Disabled
36 class HTML5Gaming(benchmark.Benchmark): 37 class HTML5Gaming(benchmark.Benchmark):
37 """Imapct HTML5 smooth running games benchmark suite.""" 38 """Imapct HTML5 smooth running games benchmark suite."""
38 test = _HTML5GamingMeasurement 39 test = _HTML5GamingMeasurement
39 def CreatePageSet(self, options): 40 def CreatePageSet(self, options):
40 ps = page_set.PageSet( 41 ps = page_set.PageSet(
41 file_path=os.path.abspath(__file__), 42 file_path=os.path.abspath(__file__),
42 archive_data_file='../page_sets/data/html5gaming.json', 43 archive_data_file='../page_sets/data/html5gaming.json',
43 make_javascript_deterministic=False) 44 make_javascript_deterministic=False)
44 ps.AddPageWithDefaultRunNavigate('http://html5-benchmark.com/') 45 ps.AddPageWithDefaultRunNavigate('http://html5-benchmark.com/')
45 return ps 46 return ps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698