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 run_pywebsocket_server = True | |
|
nednguyen
2015/01/05 23:10:58
What is this variable for?
hiroshige
2015/01/06 05:42:51
Removed.
| |
| 108 | |
| 109 def __init__(self): | |
| 110 super(_BlinkPerfWithPywebsocketMeasurement, self).__init__() | |
| 111 self.needs_pywebsocket_server = True | |
|
nednguyen
2015/01/05 23:10:58
also this one?
hiroshige
2015/01/06 05:42:51
Removed.
| |
| 112 | |
| 113 def CustomizeBrowserOptions(self, options): | |
| 114 super(_BlinkPerfWithPywebsocketMeasurement, self).CustomizeBrowserOptions( | |
| 115 options) | |
| 116 # Cross-origin accesses are needed to run benchmarks spanning two servers, | |
| 117 # the Telemetry's HTTP server and the pywebsocket server. | |
| 118 options.AppendExtraBrowserArgs([ | |
| 119 '--disable-web-security' | |
| 120 ]) | |
| 121 | |
| 122 def DidStartBrowser(self, browser): | |
| 123 if browser.GetRunningLocalServer( | |
| 124 pywebsocket_server.PywebsocketServer, None): | |
| 125 return | |
| 126 | |
| 127 server = pywebsocket_server.PywebsocketServer() | |
| 128 browser.StartLocalServer(server) | |
| 129 return | |
| 130 | |
|
nednguyen
2015/01/05 23:10:58
I don't see you override the ValidateAndMeasurePag
hiroshige
2015/01/06 05:42:51
ValidateAndMeasurePage is overridden by the parent
| |
| 131 | |
| 104 class _BlinkPerfFullFrameMeasurement(_BlinkPerfMeasurement): | 132 class _BlinkPerfFullFrameMeasurement(_BlinkPerfMeasurement): |
| 105 def __init__(self): | 133 def __init__(self): |
| 106 super(_BlinkPerfFullFrameMeasurement, self).__init__() | 134 super(_BlinkPerfFullFrameMeasurement, self).__init__() |
| 107 self._blink_perf_js += '\nwindow.fullFrameMeasurement = true;' | 135 self._blink_perf_js += '\nwindow.fullFrameMeasurement = true;' |
| 108 | 136 |
| 109 def CustomizeBrowserOptions(self, options): | 137 def CustomizeBrowserOptions(self, options): |
| 110 super(_BlinkPerfFullFrameMeasurement, self).CustomizeBrowserOptions( | 138 super(_BlinkPerfFullFrameMeasurement, self).CustomizeBrowserOptions( |
| 111 options) | 139 options) |
| 112 # Full layout measurement needs content_shell with internals testing API. | 140 # Full layout measurement needs content_shell with internals testing API. |
| 113 assert 'content-shell' in options.browser_type | 141 assert 'content-shell' in options.browser_type |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 | 265 |
| 238 # This benchmark is for local testing, doesn't need to run on bots. | 266 # This benchmark is for local testing, doesn't need to run on bots. |
| 239 @benchmark.Disabled() | 267 @benchmark.Disabled() |
| 240 class BlinkPerfXMLHttpRequest(benchmark.Benchmark): | 268 class BlinkPerfXMLHttpRequest(benchmark.Benchmark): |
| 241 tag = 'xml_http_request' | 269 tag = 'xml_http_request' |
| 242 test = _BlinkPerfMeasurement | 270 test = _BlinkPerfMeasurement |
| 243 | 271 |
| 244 def CreatePageSet(self, options): | 272 def CreatePageSet(self, options): |
| 245 path = os.path.join(BLINK_PERF_BASE_DIR, 'XMLHttpRequest') | 273 path = os.path.join(BLINK_PERF_BASE_DIR, 'XMLHttpRequest') |
| 246 return CreatePageSetFromPath(path, SKIPPED_FILE) | 274 return CreatePageSetFromPath(path, SKIPPED_FILE) |
| 275 | |
| 276 | |
| 277 class BlinkPerfPywebsocket(benchmark.Benchmark): | |
| 278 tag = 'pywebsocket' | |
| 279 test = _BlinkPerfWithPywebsocketMeasurement | |
| 280 | |
| 281 def CreatePageSet(self, options): | |
| 282 path = os.path.join(BLINK_PERF_BASE_DIR, 'Pywebsocket') | |
| 283 return CreatePageSetFromPath(path, SKIPPED_FILE) | |
| OLD | NEW |