Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 import csv | 4 import csv |
| 5 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 import sys | 7 import sys |
| 8 import traceback | 8 import traceback |
| 9 | 9 |
| 10 from chrome_remote_control import browser_finder | 10 from chrome_remote_control import browser_finder |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 | 91 |
| 92 def Run(self, results_writer, browser, options, ps): | 92 def Run(self, results_writer, browser, options, ps): |
| 93 """Runs the actual benchmark, starting the browser using outputting results | 93 """Runs the actual benchmark, starting the browser using outputting results |
| 94 to results_writer. | 94 to results_writer. |
| 95 | 95 |
| 96 If args is not specified, sys.argv[1:] is used. | 96 If args is not specified, sys.argv[1:] is used. |
| 97 """ | 97 """ |
| 98 self.options = options | 98 self.options = options |
| 99 self.field_names = None | 99 self.field_names = None |
| 100 | 100 |
| 101 pr = page_runner.PageRunner(ps) | 101 pr = page_runner.PageRunner(ps, options) |
|
nduca
2012/09/21 06:35:50
i wonder if we should make the page runner manage
tonyg
2012/09/25 17:29:29
Done.
| |
| 102 with browser.ConnectToNthTab(0) as tab: | 102 with browser.ConnectToNthTab(0) as tab: |
| 103 for page in ps.pages: | 103 for page in ps.pages: |
| 104 self._RunPage(results_writer, pr, page, tab) | 104 self._RunPage(results_writer, pr, page, tab) |
| 105 pr.Close() | 105 pr.Close() |
| 106 | 106 |
| 107 self.options = None | 107 self.options = None |
| 108 self.field_names = None | 108 self.field_names = None |
| 109 | 109 |
| 110 def _RunPage(self, results_writer, pr, page, tab): | 110 def _RunPage(self, results_writer, pr, page, tab): |
| 111 logging.debug('Running test on %s' % page.url) | 111 logging.debug('Running test on %s' % page.url) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 'Use --browser=list to figure out which are available.\n') | 177 'Use --browser=list to figure out which are available.\n') |
| 178 sys.exit(1) | 178 sys.exit(1) |
| 179 | 179 |
| 180 with possible_browser.Create() as browser: | 180 with possible_browser.Create() as browser: |
| 181 benchmark.Run(csv.writer(sys.stdout), browser, options, ps) | 181 benchmark.Run(csv.writer(sys.stdout), browser, options, ps) |
| 182 | 182 |
| 183 if len(benchmark.page_failures): | 183 if len(benchmark.page_failures): |
| 184 logging.warning('Failed pages: %s', '\n'.join( | 184 logging.warning('Failed pages: %s', '\n'.join( |
| 185 [failure['page'].url for failure in benchmark.page_failures])) | 185 [failure['page'].url for failure in benchmark.page_failures])) |
| 186 return len(benchmark.page_failures) | 186 return len(benchmark.page_failures) |
| OLD | NEW |