OLD | NEW |
1 # Copyright 2012 The Chromium Authors. All rights reserved. | 1 # Copyright 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 | 4 |
5 import collections | 5 import collections |
6 import copy | 6 import copy |
7 import logging | 7 import logging |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import random | 10 import random |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 223 |
224 if args.page_repeat < 1: | 224 if args.page_repeat < 1: |
225 parser.error('--page-repeat must be a positive integer.') | 225 parser.error('--page-repeat must be a positive integer.') |
226 if args.pageset_repeat < 1: | 226 if args.pageset_repeat < 1: |
227 parser.error('--pageset-repeat must be a positive integer.') | 227 parser.error('--pageset-repeat must be a positive integer.') |
228 | 228 |
229 | 229 |
230 def _PrepareAndRunPage(test, page_set, expectations, finder_options, | 230 def _PrepareAndRunPage(test, page_set, expectations, finder_options, |
231 browser_options, page, credentials_path, | 231 browser_options, page, credentials_path, |
232 possible_browser, results, state): | 232 possible_browser, results, state): |
233 if browser_options.wpr_mode != wpr_modes.WPR_RECORD: | 233 if finder_options.use_live_sites: |
| 234 browser_options.wpr_mode = wpr_modes.WPR_OFF |
| 235 elif browser_options.wpr_mode != wpr_modes.WPR_RECORD: |
234 browser_options.wpr_mode = ( | 236 browser_options.wpr_mode = ( |
235 wpr_modes.WPR_REPLAY | 237 wpr_modes.WPR_REPLAY |
236 if page.archive_path and os.path.isfile(page.archive_path) | 238 if page.archive_path and os.path.isfile(page.archive_path) |
237 else wpr_modes.WPR_OFF) | 239 else wpr_modes.WPR_OFF) |
238 | 240 |
239 tries = test.attempts | 241 tries = test.attempts |
240 while tries: | 242 while tries: |
241 tries -= 1 | 243 tries -= 1 |
242 try: | 244 try: |
243 results_for_current_run = copy.copy(results) | 245 results_for_current_run = copy.copy(results) |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 raise | 299 raise |
298 logging.warning(e) | 300 logging.warning(e) |
299 | 301 |
300 | 302 |
301 def _UpdatePageSetArchivesIfChanged(page_set): | 303 def _UpdatePageSetArchivesIfChanged(page_set): |
302 # Attempt to download the credentials file. | 304 # Attempt to download the credentials file. |
303 if page_set.credentials_path: | 305 if page_set.credentials_path: |
304 try: | 306 try: |
305 cloud_storage.GetIfChanged( | 307 cloud_storage.GetIfChanged( |
306 os.path.join(page_set.base_dir, page_set.credentials_path)) | 308 os.path.join(page_set.base_dir, page_set.credentials_path)) |
307 except (cloud_storage.CredentialsError, cloud_storage.PermissionError): | 309 except (cloud_storage.CredentialsError, cloud_storage.PermissionError, |
308 logging.warning('Cannot retrieve credential file: %s', | 310 cloud_storage.CloudStorageError) as e: |
309 page_set.credentials_path) | 311 logging.warning('Cannot retrieve credential file %s due to cloud storage ' |
| 312 'error %s', page_set.credentials_path, str(e)) |
| 313 |
310 # Scan every serving directory for .sha1 files | 314 # Scan every serving directory for .sha1 files |
311 # and download them from Cloud Storage. Assume all data is public. | 315 # and download them from Cloud Storage. Assume all data is public. |
312 all_serving_dirs = page_set.serving_dirs.copy() | 316 all_serving_dirs = page_set.serving_dirs.copy() |
313 # Add individual page dirs to all serving dirs. | 317 # Add individual page dirs to all serving dirs. |
314 for page in page_set: | 318 for page in page_set: |
315 if page.is_file: | 319 if page.is_file: |
316 all_serving_dirs.add(page.serving_dir) | 320 all_serving_dirs.add(page.serving_dir) |
317 # Scan all serving dirs. | 321 # Scan all serving dirs. |
318 for serving_dir in all_serving_dirs: | 322 for serving_dir in all_serving_dirs: |
319 if os.path.splitdrive(serving_dir)[1] == '/': | 323 if os.path.splitdrive(serving_dir)[1] == '/': |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 logging.warning('Device is thermally throttled before running ' | 572 logging.warning('Device is thermally throttled before running ' |
569 'performance tests, results will vary.') | 573 'performance tests, results will vary.') |
570 | 574 |
571 | 575 |
572 def _CheckThermalThrottling(platform): | 576 def _CheckThermalThrottling(platform): |
573 if not platform.CanMonitorThermalThrottling(): | 577 if not platform.CanMonitorThermalThrottling(): |
574 return | 578 return |
575 if platform.HasBeenThermallyThrottled(): | 579 if platform.HasBeenThermallyThrottled(): |
576 logging.warning('Device has been thermally throttled during ' | 580 logging.warning('Device has been thermally throttled during ' |
577 'performance tests, results will vary.') | 581 'performance tests, results will vary.') |
OLD | NEW |