Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 datetime | 7 import datetime |
| 8 import itertools | 8 import itertools |
| 9 import logging | 9 import logging |
| 10 import random | 10 import random |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 return [v for v in values if isinstance(v, failure.FailureValue)] | 120 return [v for v in values if isinstance(v, failure.FailureValue)] |
| 121 | 121 |
| 122 @property | 122 @property |
| 123 def skipped_values(self): | 123 def skipped_values(self): |
| 124 values = self.all_page_specific_values | 124 values = self.all_page_specific_values |
| 125 return [v for v in values if isinstance(v, skip.SkipValue)] | 125 return [v for v in values if isinstance(v, skip.SkipValue)] |
| 126 | 126 |
| 127 def _GetStringFromExcInfo(self, err): | 127 def _GetStringFromExcInfo(self, err): |
| 128 return ''.join(traceback.format_exception(*err)) | 128 return ''.join(traceback.format_exception(*err)) |
| 129 | 129 |
| 130 def CleanUp(self): | |
| 131 """Clean up any TraceValues contained within this results object.""" | |
| 132 for run in self._all_page_runs: | |
| 133 for v in run.values: | |
| 134 if isinstance(v, trace.TraceValue): | |
| 135 v.CleanUp() | |
| 136 run.values.remove(v) | |
|
nednguyen
2015/02/18 18:35:59
Why do you change this implementation?
eakuefner
2015/02/18 20:41:03
all_page_specific_values is actually a @property t
| |
| 137 | |
| 138 def __enter__(self): | |
| 139 return self | |
| 140 | |
| 141 def __exit__(self, _, __, ___): | |
| 142 self.CleanUp() | |
| 143 | |
| 130 def WillRunPage(self, page): | 144 def WillRunPage(self, page): |
| 131 assert not self._current_page_run, 'Did not call DidRunPage.' | 145 assert not self._current_page_run, 'Did not call DidRunPage.' |
| 132 self._current_page_run = page_run.PageRun(page) | 146 self._current_page_run = page_run.PageRun(page) |
| 133 self._progress_reporter.WillRunPage(self) | 147 self._progress_reporter.WillRunPage(self) |
| 134 | 148 |
| 135 def DidRunPage(self, page, discard_run=False): # pylint: disable=W0613 | 149 def DidRunPage(self, page, discard_run=False): # pylint: disable=W0613 |
| 136 """ | 150 """ |
| 137 Args: | 151 Args: |
| 138 page: The current page under test. | 152 page: The current page under test. |
| 139 discard_run: Whether to discard the entire run and all of its | 153 discard_run: Whether to discard the entire run and all of its |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 try: | 237 try: |
| 224 cloud_url = cloud_storage.Insert( | 238 cloud_url = cloud_storage.Insert( |
| 225 bucket, remote_path, file_handle.GetAbsPath()) | 239 bucket, remote_path, file_handle.GetAbsPath()) |
| 226 sys.stderr.write( | 240 sys.stderr.write( |
| 227 'View generated profiler files online at %s for page %s\n' % | 241 'View generated profiler files online at %s for page %s\n' % |
| 228 (cloud_url, page.display_name)) | 242 (cloud_url, page.display_name)) |
| 229 self._pages_to_profiling_files_cloud_url[page].append(cloud_url) | 243 self._pages_to_profiling_files_cloud_url[page].append(cloud_url) |
| 230 except cloud_storage.PermissionError as e: | 244 except cloud_storage.PermissionError as e: |
| 231 logging.error('Cannot upload profiling files to cloud storage due to ' | 245 logging.error('Cannot upload profiling files to cloud storage due to ' |
| 232 ' permission error: %s' % e.message) | 246 ' permission error: %s' % e.message) |
| OLD | NEW |