OLD | NEW |
1 # Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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 """Runs spaceport.io's PerfMarks benchmark.""" | 5 """Runs spaceport.io's PerfMarks benchmark.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 | 9 |
| 10 from measurements import PageTestMeasurement |
10 from telemetry import benchmark | 11 from telemetry import benchmark |
11 from telemetry.core import util | 12 from telemetry.core import util |
12 from telemetry.page import page_set | 13 from telemetry.page import page_set |
13 from telemetry.page import page_test | |
14 from telemetry.value import list_of_scalar_values | 14 from telemetry.value import list_of_scalar_values |
15 from telemetry.value import scalar | 15 from telemetry.value import scalar |
16 | 16 |
17 DESCRIPTIONS = { | 17 DESCRIPTIONS = { |
18 'canvasDrawImageFullClear': | 18 'canvasDrawImageFullClear': |
19 'Using a canvas element to render. Bitmaps are blitted to the canvas ' | 19 'Using a canvas element to render. Bitmaps are blitted to the canvas ' |
20 'using the "drawImage" function and the canvas is fully cleared at ' | 20 'using the "drawImage" function and the canvas is fully cleared at ' |
21 'the beginning of each frame.', | 21 'the beginning of each frame.', |
22 'canvasDrawImageFullClearAlign': | 22 'canvasDrawImageFullClearAlign': |
23 'Same as canvasDrawImageFullClear except all "x" and "y" values are ' | 23 'Same as canvasDrawImageFullClear except all "x" and "y" values are ' |
(...skipping 15 matching lines...) Expand all Loading... |
39 'css2dImg': | 39 'css2dImg': |
40 'Same as css2dBackground, but using img elements instead of div ' | 40 'Same as css2dBackground, but using img elements instead of div ' |
41 'elements.', | 41 'elements.', |
42 'css3dBackground': | 42 'css3dBackground': |
43 'Same as css2dBackground, but using CSS-3D transforms.', | 43 'Same as css2dBackground, but using CSS-3D transforms.', |
44 'css3dImg': | 44 'css3dImg': |
45 'Same as css2dImage but using CSS-3D tranforms.', | 45 'Same as css2dImage but using CSS-3D tranforms.', |
46 } | 46 } |
47 | 47 |
48 | 48 |
49 class _SpaceportMeasurement(page_test.PageTest): | 49 class _SpaceportMeasurement(PageTestMeasurement): |
50 def __init__(self): | 50 def __init__(self): |
51 super(_SpaceportMeasurement, self).__init__() | 51 super(_SpaceportMeasurement, self).__init__() |
52 | 52 |
53 def CustomizeBrowserOptions(self, options): | 53 def CustomizeBrowserOptions(self, options): |
| 54 super(_SpaceportMeasurement, self).CustomizeBrowserOptions(options) |
54 options.AppendExtraBrowserArgs('--disable-gpu-vsync') | 55 options.AppendExtraBrowserArgs('--disable-gpu-vsync') |
55 | 56 |
56 def ValidateAndMeasurePage(self, page, tab, results): | 57 def ValidateAndMeasurePage(self, page, tab, results): |
57 tab.WaitForJavaScriptExpression( | 58 tab.WaitForJavaScriptExpression( |
58 '!document.getElementById("start-performance-tests").disabled', 60) | 59 '!document.getElementById("start-performance-tests").disabled', 60) |
59 | 60 |
60 tab.ExecuteJavaScript(""" | 61 tab.ExecuteJavaScript(""" |
61 window.__results = {}; | 62 window.__results = {}; |
62 window.console.log = function(str) { | 63 window.console.log = function(str) { |
63 if (!str) return; | 64 if (!str) return; |
(...skipping 19 matching lines...) Expand all Loading... |
83 for key in result_dict: | 84 for key in result_dict: |
84 chart, trace = key.split('.', 1) | 85 chart, trace = key.split('.', 1) |
85 results.AddValue(scalar.ScalarValue( | 86 results.AddValue(scalar.ScalarValue( |
86 results.current_page, '%s.%s'% (chart, trace), | 87 results.current_page, '%s.%s'% (chart, trace), |
87 'objects (bigger is better)', float(result_dict[key]), | 88 'objects (bigger is better)', float(result_dict[key]), |
88 important=False, description=DESCRIPTIONS.get(chart))) | 89 important=False, description=DESCRIPTIONS.get(chart))) |
89 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 90 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
90 results.current_page, 'Score', 'objects (bigger is better)', | 91 results.current_page, 'Score', 'objects (bigger is better)', |
91 [float(x) for x in result_dict.values()], | 92 [float(x) for x in result_dict.values()], |
92 description='Combined score for all parts of the spaceport benchmark.')) | 93 description='Combined score for all parts of the spaceport benchmark.')) |
| 94 super(_SpaceportMeasurement, self).ValidateAndMeasurePage( |
| 95 page, tab, results) |
93 | 96 |
94 | 97 |
95 # crbug.com/166703: This test frequently times out on Windows. | 98 # crbug.com/166703: This test frequently times out on Windows. |
96 @benchmark.Disabled('mac', 'win') | 99 @benchmark.Disabled('mac', 'win') |
97 class Spaceport(benchmark.Benchmark): | 100 class Spaceport(benchmark.Benchmark): |
98 """spaceport.io's PerfMarks benchmark.""" | 101 """spaceport.io's PerfMarks benchmark.""" |
99 test = _SpaceportMeasurement | 102 test = _SpaceportMeasurement |
100 | 103 |
101 def CreatePageSet(self, options): | 104 def CreatePageSet(self, options): |
102 spaceport_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test', | 105 spaceport_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test', |
103 'data', 'third_party', 'spaceport') | 106 'data', 'third_party', 'spaceport') |
104 ps = page_set.PageSet(file_path=spaceport_dir) | 107 ps = page_set.PageSet(file_path=spaceport_dir) |
105 ps.AddPageWithDefaultRunNavigate('file://index.html') | 108 ps.AddPageWithDefaultRunNavigate('file://index.html') |
106 return ps | 109 return ps |
OLD | NEW |