| 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 itertools |
| 8 import os |
| 7 import traceback | 9 import traceback |
| 8 | 10 |
| 9 from telemetry import value as value_module | 11 from telemetry import value as value_module |
| 10 from telemetry.results import page_run | 12 from telemetry.results import page_run |
| 11 from telemetry.results import progress_reporter as progress_reporter_module | 13 from telemetry.results import progress_reporter as progress_reporter_module |
| 12 from telemetry.value import failure | 14 from telemetry.value import failure |
| 13 from telemetry.value import skip | 15 from telemetry.value import skip |
| 14 | 16 |
| 15 | 17 |
| 16 class PageTestResults(object): | 18 class PageTestResults(object): |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 values += run.values | 61 values += run.values |
| 60 if self._current_page_run: | 62 if self._current_page_run: |
| 61 values += self._current_page_run.values | 63 values += self._current_page_run.values |
| 62 return values | 64 return values |
| 63 | 65 |
| 64 @property | 66 @property |
| 65 def all_summary_values(self): | 67 def all_summary_values(self): |
| 66 return self._all_summary_values | 68 return self._all_summary_values |
| 67 | 69 |
| 68 @property | 70 @property |
| 71 def all_values(self): |
| 72 return itertools.chain( |
| 73 self.all_page_specific_values, |
| 74 self.all_summary_values) |
| 75 |
| 76 @property |
| 69 def current_page(self): | 77 def current_page(self): |
| 70 assert self._current_page_run, 'Not currently running test.' | 78 assert self._current_page_run, 'Not currently running test.' |
| 71 return self._current_page_run.page | 79 return self._current_page_run.page |
| 72 | 80 |
| 73 @property | 81 @property |
| 74 def current_page_run(self): | 82 def current_page_run(self): |
| 75 assert self._current_page_run, 'Not currently running test.' | 83 assert self._current_page_run, 'Not currently running test.' |
| 76 return self._current_page_run | 84 return self._current_page_run |
| 77 | 85 |
| 78 @property | 86 @property |
| (...skipping 10 matching lines...) Expand all Loading... |
| 89 @property | 97 @property |
| 90 def pages_that_failed(self): | 98 def pages_that_failed(self): |
| 91 """Returns the set of failed pages.""" | 99 """Returns the set of failed pages.""" |
| 92 failed_pages = set() | 100 failed_pages = set() |
| 93 for run in self.all_page_runs: | 101 for run in self.all_page_runs: |
| 94 if run.failed: | 102 if run.failed: |
| 95 failed_pages.add(run.page) | 103 failed_pages.add(run.page) |
| 96 return failed_pages | 104 return failed_pages |
| 97 | 105 |
| 98 @property | 106 @property |
| 107 def all_paths(self): |
| 108 """Returns the set of all paths to referenced files. |
| 109 |
| 110 Since we are dealing with paths, and paths are not necessarily unique even |
| 111 if they refer to the same file, we canonicalize paths using |
| 112 os.path.normcase and os.path.realpath before adding them to the set that we |
| 113 return. |
| 114 """ |
| 115 paths = set() |
| 116 for v in self.all_values: |
| 117 paths.update(os.path.normcase(os.path.realpath(path)) for path in v.paths) |
| 118 |
| 119 return paths |
| 120 |
| 121 @property |
| 99 def failures(self): | 122 def failures(self): |
| 100 values = self.all_page_specific_values | 123 values = self.all_page_specific_values |
| 101 return [v for v in values if isinstance(v, failure.FailureValue)] | 124 return [v for v in values if isinstance(v, failure.FailureValue)] |
| 102 | 125 |
| 103 @property | 126 @property |
| 104 def skipped_values(self): | 127 def skipped_values(self): |
| 105 values = self.all_page_specific_values | 128 values = self.all_page_specific_values |
| 106 return [v for v in values if isinstance(v, skip.SkipValue)] | 129 return [v for v in values if isinstance(v, skip.SkipValue)] |
| 107 | 130 |
| 108 def _GetStringFromExcInfo(self, err): | 131 def _GetStringFromExcInfo(self, err): |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 if value.page == page and value.name == value_name: | 197 if value.page == page and value.name == value_name: |
| 175 values.append(value) | 198 values.append(value) |
| 176 return values | 199 return values |
| 177 | 200 |
| 178 def FindAllPageSpecificValuesNamed(self, value_name): | 201 def FindAllPageSpecificValuesNamed(self, value_name): |
| 179 values = [] | 202 values = [] |
| 180 for value in self.all_page_specific_values: | 203 for value in self.all_page_specific_values: |
| 181 if value.name == value_name: | 204 if value.name == value_name: |
| 182 values.append(value) | 205 values.append(value) |
| 183 return values | 206 return values |
| OLD | NEW |