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 """Basic pyauto performance tests. | 6 """Basic pyauto performance tests. |
7 | 7 |
8 For tests that need to be run for multiple iterations (e.g., so that average | 8 For tests that need to be run for multiple iterations (e.g., so that average |
9 and standard deviation values can be reported), the default number of iterations | 9 and standard deviation values can be reported), the default number of iterations |
10 run for each of these tests is specified by |_DEFAULT_NUM_ITERATIONS|. | 10 run for each of these tests is specified by |_DEFAULT_NUM_ITERATIONS|. |
(...skipping 2268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2279 performance issues that may result from introducing network delays and | 2279 performance issues that may result from introducing network delays and |
2280 bandwidth throttling. | 2280 bandwidth throttling. |
2281 """ | 2281 """ |
2282 _PATHS = { | 2282 _PATHS = { |
2283 'archive': 'src/data/page_cycler/webpagereplay/{test_name}.wpr', | 2283 'archive': 'src/data/page_cycler/webpagereplay/{test_name}.wpr', |
2284 'page_sets': 'src/tools/page_cycler/webpagereplay/tests/{test_name}.js', | 2284 'page_sets': 'src/tools/page_cycler/webpagereplay/tests/{test_name}.js', |
2285 'start_page': 'src/tools/page_cycler/webpagereplay/start.html', | 2285 'start_page': 'src/tools/page_cycler/webpagereplay/start.html', |
2286 'extension': 'src/tools/page_cycler/webpagereplay/extension', | 2286 'extension': 'src/tools/page_cycler/webpagereplay/extension', |
2287 } | 2287 } |
2288 | 2288 |
2289 CHROME_FLAGS = webpagereplay.CHROME_FLAGS + [ | 2289 WEBPAGEREPLAY_HOST = '127.0.0.1' |
2290 '--log-level=0', | 2290 WEBPAGEREPLAY_HTTP_PORT = 8080 |
2291 '--disable-background-networking', | 2291 WEBPAGEREPLAY_HTTPS_PORT = 8413 |
2292 '--enable-experimental-extension-apis', | 2292 |
2293 '--enable-logging', | 2293 CHROME_FLAGS = webpagereplay.GetChromeFlags( |
2294 '--enable-benchmarking', | 2294 self.WEBPAGEREPLAY_HOST, |
2295 '--metrics-recording-only', | 2295 self.WEBPAGEREPLAY_HTTP_PORT, |
2296 '--activate-on-launch', | 2296 self.WEBPAGEREPLAY_HTTPS_PORT) + [ |
2297 '--no-first-run', | 2297 '--log-level=0', |
2298 '--no-proxy-server', | 2298 '--disable-background-networking', |
2299 ] | 2299 '--enable-experimental-extension-apis', |
| 2300 '--enable-logging', |
| 2301 '--enable-benchmarking', |
| 2302 '--metrics-recording-only', |
| 2303 '--activate-on-launch', |
| 2304 '--no-first-run', |
| 2305 '--no-proxy-server', |
| 2306 ] |
2300 | 2307 |
2301 @classmethod | 2308 @classmethod |
2302 def Path(cls, key, **kwargs): | 2309 def Path(cls, key, **kwargs): |
2303 return FormatChromePath(cls._PATHS[key], **kwargs) | 2310 return FormatChromePath(cls._PATHS[key], **kwargs) |
2304 | 2311 |
2305 @classmethod | 2312 @classmethod |
2306 def ReplayServer(cls, test_name, replay_options=None): | 2313 def ReplayServer(cls, test_name, replay_options=None): |
2307 archive_path = cls.Path('archive', test_name=test_name) | 2314 archive_path = cls.Path('archive', test_name=test_name) |
2308 return webpagereplay.ReplayServer(archive_path, replay_options) | 2315 return webpagereplay.ReplayServer(archive_path, |
| 2316 self.WEBPAGEREPLAY_HOST, |
| 2317 self.WEBPAGEREPLAY_HTTP_PORT, |
| 2318 self.WEBPAGEREPLAY_HTTPS_PORT, |
| 2319 replay_options) |
2309 | 2320 |
2310 | 2321 |
2311 class PageCyclerNetSimTest(BasePageCyclerTest): | 2322 class PageCyclerNetSimTest(BasePageCyclerTest): |
2312 """Tests to run Web Page Replay backed page cycler tests.""" | 2323 """Tests to run Web Page Replay backed page cycler tests.""" |
2313 MAX_ITERATION_SECONDS = 180 | 2324 MAX_ITERATION_SECONDS = 180 |
2314 | 2325 |
2315 def ExtraChromeFlags(self): | 2326 def ExtraChromeFlags(self): |
2316 """Ensures Chrome is launched with custom flags. | 2327 """Ensures Chrome is launched with custom flags. |
2317 | 2328 |
2318 Returns: | 2329 Returns: |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2682 """Identifies the port number to which the server is currently bound. | 2693 """Identifies the port number to which the server is currently bound. |
2683 | 2694 |
2684 Returns: | 2695 Returns: |
2685 The numeric port number to which the server is currently bound. | 2696 The numeric port number to which the server is currently bound. |
2686 """ | 2697 """ |
2687 return self._server.server_address[1] | 2698 return self._server.server_address[1] |
2688 | 2699 |
2689 | 2700 |
2690 if __name__ == '__main__': | 2701 if __name__ == '__main__': |
2691 pyauto_functional.Main() | 2702 pyauto_functional.Main() |
OLD | NEW |