OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Performance tests for Chrome Endure (long-running perf tests on Chrome). | 6 """Performance tests for Chrome Endure (long-running perf tests on Chrome). |
7 | 7 |
8 This module accepts the following environment variable inputs: | 8 This module accepts the following environment variable inputs: |
9 TEST_LENGTH: The number of seconds in which to run each test. | 9 TEST_LENGTH: The number of seconds in which to run each test. |
10 PERF_STATS_INTERVAL: The number of seconds to wait in-between each sampling | 10 PERF_STATS_INTERVAL: The number of seconds to wait in-between each sampling |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 | 1280 |
1281 class ChromeEndureReplay(object): | 1281 class ChromeEndureReplay(object): |
1282 """Run Chrome Endure tests with network simulation via Web Page Replay.""" | 1282 """Run Chrome Endure tests with network simulation via Web Page Replay.""" |
1283 | 1283 |
1284 _PATHS = { | 1284 _PATHS = { |
1285 'archive': | 1285 'archive': |
1286 'src/chrome/test/data/pyauto_private/webpagereplay/{archive_name}', | 1286 'src/chrome/test/data/pyauto_private/webpagereplay/{archive_name}', |
1287 'scripts': | 1287 'scripts': |
1288 'src/chrome/test/data/chrome_endure/webpagereplay/wpr_deterministic.js', | 1288 'src/chrome/test/data/chrome_endure/webpagereplay/wpr_deterministic.js', |
1289 } | 1289 } |
1290 CHROME_FLAGS = webpagereplay.CHROME_FLAGS | 1290 |
| 1291 WEBPAGEREPLAY_HOST = '127.0.0.1' |
| 1292 WEBPAGEREPLAY_HTTP_PORT = 8080 |
| 1293 WEBPAGEREPLAY_HTTPS_PORT = 8413 |
| 1294 |
| 1295 CHROME_FLAGS = webpagereplay.GetChromeFlags( |
| 1296 self.WEBPAGEREPLAY_HOST, |
| 1297 self.WEBPAGEREPLAY_HTTP_PORT, |
| 1298 self.WEBPAGEREPLAY_HTTPS_PORT) |
1291 | 1299 |
1292 @classmethod | 1300 @classmethod |
1293 def Path(cls, key, **kwargs): | 1301 def Path(cls, key, **kwargs): |
1294 return perf.FormatChromePath(cls._PATHS[key], **kwargs) | 1302 return perf.FormatChromePath(cls._PATHS[key], **kwargs) |
1295 | 1303 |
1296 @classmethod | 1304 @classmethod |
1297 def ReplayServer(cls, archive_path): | 1305 def ReplayServer(cls, archive_path): |
1298 """Create a replay server.""" | 1306 """Create a replay server.""" |
1299 # Inject customized scripts for Google webapps. | 1307 # Inject customized scripts for Google webapps. |
1300 # See the javascript file for details. | 1308 # See the javascript file for details. |
1301 scripts = cls.Path('scripts') | 1309 scripts = cls.Path('scripts') |
1302 if not os.path.exists(scripts): | 1310 if not os.path.exists(scripts): |
1303 raise IOError('Injected scripts %s not found.' % scripts) | 1311 raise IOError('Injected scripts %s not found.' % scripts) |
1304 replay_options = ['--inject_scripts', scripts] | 1312 replay_options = ['--inject_scripts', scripts] |
1305 if 'WPR_RECORD' in os.environ: | 1313 if 'WPR_RECORD' in os.environ: |
1306 replay_options.append('--append') | 1314 replay_options.append('--append') |
1307 return webpagereplay.ReplayServer(archive_path, replay_options) | 1315 return webpagereplay.ReplayServer(archive_path, |
| 1316 self.WEBPAGEREPLAY_HOST, |
| 1317 self.WEBPAGEREPLAY_HTTP_PORT, |
| 1318 self.WEBPAGEREPLAY_HTTPS_PORT, |
| 1319 replay_options) |
1308 | 1320 |
1309 | 1321 |
1310 if __name__ == '__main__': | 1322 if __name__ == '__main__': |
1311 pyauto_functional.Main() | 1323 pyauto_functional.Main() |
OLD | NEW |