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 benchmarks import pywebsocket_server | |
| 7 from telemetry import benchmark | 8 from telemetry import benchmark |
| 8 from telemetry import page as page_module | 9 from telemetry import page as page_module |
| 9 from telemetry.core import util | 10 from telemetry.core import util |
| 10 from telemetry.page import page_set | 11 from telemetry.page import page_set |
| 11 from telemetry.page import page_test | 12 from telemetry.page import page_test |
| 12 from telemetry.value import list_of_scalar_values | 13 from telemetry.value import list_of_scalar_values |
| 13 | 14 |
| 14 | 15 |
| 15 BLINK_PERF_BASE_DIR = os.path.join(util.GetChromiumSrcDir(), | 16 BLINK_PERF_BASE_DIR = os.path.join(util.GetChromiumSrcDir(), |
| 16 'third_party', 'WebKit', 'PerformanceTests') | 17 'third_party', 'WebKit', 'PerformanceTests') |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 units = parts[-1] | 95 units = parts[-1] |
| 95 metric = page.display_name.split('.')[0].replace('/', '_') | 96 metric = page.display_name.split('.')[0].replace('/', '_') |
| 96 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 97 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
| 97 results.current_page, metric, units, values)) | 98 results.current_page, metric, units, values)) |
| 98 | 99 |
| 99 break | 100 break |
| 100 | 101 |
| 101 print log | 102 print log |
| 102 | 103 |
| 103 | 104 |
| 105 class _BlinkPerfWithPywebsocketMeasurement(_BlinkPerfMeasurement): | |
| 106 """Runs a Blink performance test with pywebsocket server.""" | |
| 107 | |
| 108 def __init__(self): | |
| 109 super(_BlinkPerfWithPywebsocketMeasurement, self).__init__() | |
| 110 | |
| 111 def CustomizeBrowserOptions(self, options): | |
| 112 super(_BlinkPerfWithPywebsocketMeasurement, self).CustomizeBrowserOptions( | |
| 113 options) | |
| 114 # Cross-origin accesses are needed to run benchmarks spanning two servers, | |
| 115 # the Telemetry's HTTP server and the pywebsocket server. | |
| 116 options.AppendExtraBrowserArgs([ | |
| 117 '--disable-web-security' | |
| 118 ]) | |
| 119 | |
| 120 def DidStartBrowser(self, browser): | |
|
nednguyen
2015/01/21 16:45:48
Don't rely on the DidStartBrowser hook, you will w
hiroshige
2015/04/03 11:11:41
Done.
| |
| 121 if browser.GetRunningLocalServer( | |
| 122 pywebsocket_server.PywebsocketServer, None): | |
| 123 return | |
| 124 | |
| 125 server = pywebsocket_server.PywebsocketServer() | |
| 126 browser.StartLocalServer(server) | |
| 127 return | |
| 128 | |
| 129 | |
| 104 class _BlinkPerfFullFrameMeasurement(_BlinkPerfMeasurement): | 130 class _BlinkPerfFullFrameMeasurement(_BlinkPerfMeasurement): |
| 105 def __init__(self): | 131 def __init__(self): |
| 106 super(_BlinkPerfFullFrameMeasurement, self).__init__() | 132 super(_BlinkPerfFullFrameMeasurement, self).__init__() |
| 107 self._blink_perf_js += '\nwindow.fullFrameMeasurement = true;' | 133 self._blink_perf_js += '\nwindow.fullFrameMeasurement = true;' |
| 108 | 134 |
| 109 def CustomizeBrowserOptions(self, options): | 135 def CustomizeBrowserOptions(self, options): |
| 110 super(_BlinkPerfFullFrameMeasurement, self).CustomizeBrowserOptions( | 136 super(_BlinkPerfFullFrameMeasurement, self).CustomizeBrowserOptions( |
| 111 options) | 137 options) |
| 112 # Full layout measurement needs content_shell with internals testing API. | 138 # Full layout measurement needs content_shell with internals testing API. |
| 113 assert 'content-shell' in options.browser_type | 139 assert 'content-shell' in options.browser_type |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 | 263 |
| 238 # This benchmark is for local testing, doesn't need to run on bots. | 264 # This benchmark is for local testing, doesn't need to run on bots. |
| 239 @benchmark.Disabled() | 265 @benchmark.Disabled() |
| 240 class BlinkPerfXMLHttpRequest(benchmark.Benchmark): | 266 class BlinkPerfXMLHttpRequest(benchmark.Benchmark): |
| 241 tag = 'xml_http_request' | 267 tag = 'xml_http_request' |
| 242 test = _BlinkPerfMeasurement | 268 test = _BlinkPerfMeasurement |
| 243 | 269 |
| 244 def CreatePageSet(self, options): | 270 def CreatePageSet(self, options): |
| 245 path = os.path.join(BLINK_PERF_BASE_DIR, 'XMLHttpRequest') | 271 path = os.path.join(BLINK_PERF_BASE_DIR, 'XMLHttpRequest') |
| 246 return CreatePageSetFromPath(path, SKIPPED_FILE) | 272 return CreatePageSetFromPath(path, SKIPPED_FILE) |
| 273 | |
| 274 | |
| 275 class BlinkPerfPywebsocket(benchmark.Benchmark): | |
| 276 tag = 'pywebsocket' | |
| 277 test = _BlinkPerfWithPywebsocketMeasurement | |
| 278 | |
| 279 def CreatePageSet(self, options): | |
| 280 path = os.path.join(BLINK_PERF_BASE_DIR, 'Pywebsocket') | |
| 281 return CreatePageSetFromPath(path, SKIPPED_FILE) | |
| OLD | NEW |