Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 import os | 5 import os |
| 6 | 6 |
| 7 from telemetry import benchmark | 7 from telemetry import benchmark |
| 8 from telemetry.core import util | 8 from telemetry.core import util |
| 9 from telemetry.page import page_set | 9 from telemetry.page import page_set |
| 10 from telemetry.page import page_test | 10 from telemetry.page import page_test |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 """Tuns a blink performance test and reports the results.""" | 63 """Tuns a blink performance test and reports the results.""" |
| 64 def __init__(self): | 64 def __init__(self): |
| 65 super(_BlinkPerfMeasurement, self).__init__('') | 65 super(_BlinkPerfMeasurement, self).__init__('') |
| 66 with open(os.path.join(os.path.dirname(__file__), | 66 with open(os.path.join(os.path.dirname(__file__), |
| 67 'blink_perf.js'), 'r') as f: | 67 'blink_perf.js'), 'r') as f: |
| 68 self._blink_perf_js = f.read() | 68 self._blink_perf_js = f.read() |
| 69 | 69 |
| 70 def WillNavigateToPage(self, page, tab): | 70 def WillNavigateToPage(self, page, tab): |
| 71 page.script_to_evaluate_on_commit = self._blink_perf_js | 71 page.script_to_evaluate_on_commit = self._blink_perf_js |
| 72 | 72 |
| 73 # Some blink perf tests require content_shell with window.intenals API. | |
| 74 def CustomizeFinderOptions(self, options): | |
|
tonyg
2014/10/27 19:11:57
This doesn't seem right. We shouldn't just change
Xianzhu
2014/10/27 20:43:28
We want to let the tests cover the cost of composi
| |
| 75 if options.browser_type == 'release': | |
| 76 options.browser_type = 'content-shell-release' | |
| 77 elif options.browser_type == 'debug': | |
| 78 options.browser_type = 'content-shell-debug' | |
| 79 | |
| 73 def CustomizeBrowserOptions(self, options): | 80 def CustomizeBrowserOptions(self, options): |
| 74 options.AppendExtraBrowserArgs([ | 81 options.AppendExtraBrowserArgs([ |
| 75 '--js-flags=--expose_gc', | 82 '--js-flags=--expose_gc', |
| 76 '--enable-experimental-web-platform-features', | 83 '--enable-experimental-web-platform-features', |
| 77 '--disable-gesture-requirement-for-media-playback' | 84 '--disable-gesture-requirement-for-media-playback', |
| 85 '--expose-internals-for-testing' | |
| 78 ]) | 86 ]) |
| 79 | 87 |
| 80 def ValidateAndMeasurePage(self, page, tab, results): | 88 def ValidateAndMeasurePage(self, page, tab, results): |
| 81 tab.WaitForJavaScriptExpression('testRunner.isDone', 600) | 89 tab.WaitForJavaScriptExpression('testRunner.isDone', 600) |
| 82 | 90 |
| 83 log = tab.EvaluateJavaScript('document.getElementById("log").innerHTML') | 91 log = tab.EvaluateJavaScript('document.getElementById("log").innerHTML') |
| 84 | 92 |
| 85 for line in log.splitlines(): | 93 for line in log.splitlines(): |
| 86 if not line.startswith('values '): | 94 if not line.startswith('values '): |
| 87 continue | 95 continue |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 return _CreatePageSetFromPath(path, SKIPPED_FILE) | 213 return _CreatePageSetFromPath(path, SKIPPED_FILE) |
| 206 | 214 |
| 207 | 215 |
| 208 class BlinkPerfXMLHttpRequest(benchmark.Benchmark): | 216 class BlinkPerfXMLHttpRequest(benchmark.Benchmark): |
| 209 tag = 'xml_http_request' | 217 tag = 'xml_http_request' |
| 210 test = _BlinkPerfMeasurement | 218 test = _BlinkPerfMeasurement |
| 211 | 219 |
| 212 def CreatePageSet(self, options): | 220 def CreatePageSet(self, options): |
| 213 path = os.path.join(BLINK_PERF_BASE_DIR, 'XMLHttpRequest') | 221 path = os.path.join(BLINK_PERF_BASE_DIR, 'XMLHttpRequest') |
| 214 return _CreatePageSetFromPath(path, SKIPPED_FILE) | 222 return _CreatePageSetFromPath(path, SKIPPED_FILE) |
| OLD | NEW |