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 logging | 4 import logging |
| 5 import os | 5 import os |
| 6 import time | 6 import time |
| 7 import traceback | 7 import traceback |
| 8 import urlparse | 8 import urlparse |
| 9 import random | 9 import random |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 def Close(self): | 28 def Close(self): |
| 29 if self.trace_tab: | 29 if self.trace_tab: |
| 30 self.trace_tab.Close() | 30 self.trace_tab.Close() |
| 31 self.trace_tab = None | 31 self.trace_tab = None |
| 32 | 32 |
| 33 if self.tab: | 33 if self.tab: |
| 34 self.tab.Close() | 34 self.tab.Close() |
| 35 self.tab = None | 35 self.tab = None |
| 36 | 36 |
| 37 if self.browser: | 37 if self.browser: |
| 38 if self.browser.platform.CanMonitorThermalThrottling(): | |
|
nduca
2012/12/07 18:12:06
this check should be somewhere else--- probably af
bulach
2012/12/07 20:45:53
good point, done. raising an exception at the end
| |
| 39 self.browser.platform.StopMonitoringThermalThrottling() | |
| 40 self.browser.platform.SetFullPerformanceModeEnabled(False) | |
|
nduca
2012/12/07 18:12:06
this should be conditional on performance tests be
bulach
2012/12/07 20:45:53
Done.
| |
| 38 self.browser.Close() | 41 self.browser.Close() |
| 39 self.browser = None | 42 self.browser = None |
| 40 | 43 |
| 44 | |
| 41 def _ShufflePageSet(page_set, options): | 45 def _ShufflePageSet(page_set, options): |
| 42 if options.test_shuffle_order_file and not options.test_shuffle: | 46 if options.test_shuffle_order_file and not options.test_shuffle: |
| 43 raise Exception('--test-shuffle-order-file requires --test-shuffle.') | 47 raise Exception('--test-shuffle-order-file requires --test-shuffle.') |
| 44 | 48 |
| 45 if options.test_shuffle_order_file: | 49 if options.test_shuffle_order_file: |
| 46 return page_set.ReorderPageSet(options.test_shuffle_order_file) | 50 return page_set.ReorderPageSet(options.test_shuffle_order_file) |
| 47 | 51 |
| 48 pages = page_set.pages[:] | 52 pages = page_set.pages[:] |
| 49 if options.test_shuffle: | 53 if options.test_shuffle: |
| 50 random.Random().shuffle(pages) | 54 random.Random().shuffle(pages) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 | 114 |
| 111 state = _RunState() | 115 state = _RunState() |
| 112 try: | 116 try: |
| 113 for page in pages: | 117 for page in pages: |
| 114 tries = 3 | 118 tries = 3 |
| 115 while tries: | 119 while tries: |
| 116 try: | 120 try: |
| 117 if not state.browser: | 121 if not state.browser: |
| 118 self._SetupBrowser(state, test, possible_browser, | 122 self._SetupBrowser(state, test, possible_browser, |
| 119 credentials_path, archive_path) | 123 credentials_path, archive_path) |
| 124 state.browser.platform.SetFullPerformanceModeEnabled(True) | |
|
nduca
2012/12/07 18:12:06
so should this
nduca
2012/12/07 18:12:06
why not inside _SetupBrowser?
bulach
2012/12/07 20:45:53
Done.
| |
| 125 if state.browser.platform.CanMonitorThermalThrottling(): | |
| 126 state.browser.platform.StartMonitoringThermalThrottling() | |
| 120 if not state.tab: | 127 if not state.tab: |
| 121 state.tab = state.browser.ConnectToNthTab(0) | 128 state.tab = state.browser.ConnectToNthTab(0) |
| 122 if options.trace_dir: | 129 if options.trace_dir: |
| 123 self._SetupTracingTab(state) | 130 self._SetupTracingTab(state) |
| 124 | 131 |
| 125 try: | 132 try: |
| 126 self._RunPage(options, page, state.tab, test, results) | 133 self._RunPage(options, page, state.tab, test, results) |
| 127 except tab_crash_exception.TabCrashException: | 134 except tab_crash_exception.TabCrashException: |
| 128 # If we don't support tab control, just restart the browser. | 135 # If we don't support tab control, just restart the browser. |
| 129 # TODO(dtu): Create a new tab: crbug.com/155077, crbug.com/159852 | 136 # TODO(dtu): Create a new tab: crbug.com/155077, crbug.com/159852 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 return True | 313 return True |
| 307 | 314 |
| 308 def _CleanUpPage(self, page, tab, page_state): # pylint: disable=R0201 | 315 def _CleanUpPage(self, page, tab, page_state): # pylint: disable=R0201 |
| 309 if page.credentials and page_state.did_login: | 316 if page.credentials and page_state.did_login: |
| 310 tab.browser.credentials.LoginNoLongerNeeded(tab, page.credentials) | 317 tab.browser.credentials.LoginNoLongerNeeded(tab, page.credentials) |
| 311 try: | 318 try: |
| 312 tab.runtime.Evaluate("""window.chrome && chrome.benchmarking && | 319 tab.runtime.Evaluate("""window.chrome && chrome.benchmarking && |
| 313 chrome.benchmarking.closeConnections()""") | 320 chrome.benchmarking.closeConnections()""") |
| 314 except Exception: | 321 except Exception: |
| 315 pass | 322 pass |
| OLD | NEW |