| 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 270 |
| 271 try: | 271 try: |
| 272 _RunPage(test, page, state, expectation, | 272 _RunPage(test, page, state, expectation, |
| 273 results_for_current_run, finder_options) | 273 results_for_current_run, finder_options) |
| 274 _CheckThermalThrottling(state.browser.platform) | 274 _CheckThermalThrottling(state.browser.platform) |
| 275 except exceptions.TabCrashException as e: | 275 except exceptions.TabCrashException as e: |
| 276 if test.is_multi_tab_test: | 276 if test.is_multi_tab_test: |
| 277 logging.error('Aborting multi-tab test after tab %s crashed', | 277 logging.error('Aborting multi-tab test after tab %s crashed', |
| 278 page.url) | 278 page.url) |
| 279 raise | 279 raise |
| 280 logging.warning(e) | 280 logging.warning(str(e)) |
| 281 state.StopBrowser() | 281 state.StopBrowser() |
| 282 | 282 |
| 283 if finder_options.profiler: | 283 if finder_options.profiler: |
| 284 state.StopProfiling() | 284 state.StopProfiling() |
| 285 | 285 |
| 286 if (test.StopBrowserAfterPage(state.browser, page)): | 286 if (test.StopBrowserAfterPage(state.browser, page)): |
| 287 state.StopBrowser() | 287 state.StopBrowser() |
| 288 | 288 |
| 289 results_for_current_run.StopTest(page) | 289 results_for_current_run.StopTest(page) |
| 290 | 290 |
| 291 if state.first_page[page]: | 291 if state.first_page[page]: |
| 292 state.first_page[page] = False | 292 state.first_page[page] = False |
| 293 if test.discard_first_result: | 293 if test.discard_first_result: |
| 294 return results | 294 return results |
| 295 return results_for_current_run | 295 return results_for_current_run |
| 296 except exceptions.BrowserGoneException as e: | 296 except exceptions.BrowserGoneException as e: |
| 297 state.StopBrowser() | 297 state.StopBrowser() |
| 298 if not tries: | 298 if not tries: |
| 299 logging.error('Aborting after too many retries') | 299 logging.error('Aborting after too many retries') |
| 300 raise | 300 raise |
| 301 if test.is_multi_tab_test: | 301 if test.is_multi_tab_test: |
| 302 logging.error('Aborting multi-tab test after browser crashed') | 302 logging.error('Aborting multi-tab test after browser crashed') |
| 303 raise | 303 raise |
| 304 logging.warning(e) | 304 logging.warning(str(e)) |
| 305 | 305 |
| 306 | 306 |
| 307 def _UpdatePageSetArchivesIfChanged(page_set): | 307 def _UpdatePageSetArchivesIfChanged(page_set): |
| 308 # Attempt to download the credentials file. | 308 # Attempt to download the credentials file. |
| 309 if page_set.credentials_path: | 309 if page_set.credentials_path: |
| 310 try: | 310 try: |
| 311 cloud_storage.GetIfChanged( | 311 cloud_storage.GetIfChanged( |
| 312 os.path.join(page_set.base_dir, page_set.credentials_path)) | 312 os.path.join(page_set.base_dir, page_set.credentials_path)) |
| 313 except (cloud_storage.CredentialsError, cloud_storage.PermissionError, | 313 except (cloud_storage.CredentialsError, cloud_storage.PermissionError, |
| 314 cloud_storage.CloudStorageError) as e: | 314 cloud_storage.CloudStorageError) as e: |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 logging.warning('Device is thermally throttled before running ' | 580 logging.warning('Device is thermally throttled before running ' |
| 581 'performance tests, results will vary.') | 581 'performance tests, results will vary.') |
| 582 | 582 |
| 583 | 583 |
| 584 def _CheckThermalThrottling(platform): | 584 def _CheckThermalThrottling(platform): |
| 585 if not platform.CanMonitorThermalThrottling(): | 585 if not platform.CanMonitorThermalThrottling(): |
| 586 return | 586 return |
| 587 if platform.HasBeenThermallyThrottled(): | 587 if platform.HasBeenThermallyThrottled(): |
| 588 logging.warning('Device has been thermally throttled during ' | 588 logging.warning('Device has been thermally throttled during ' |
| 589 'performance tests, results will vary.') | 589 'performance tests, results will vary.') |
| OLD | NEW |