| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 """Module containing base test results classes.""" | 5 """Module containing base test results classes.""" |
| 6 | 6 |
| 7 import threading | 7 import threading |
| 8 | 8 |
| 9 | 9 |
| 10 class ResultType(object): | 10 class ResultType(object): |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 return self.GetGtestForm() | 154 return self.GetGtestForm() |
| 155 | 155 |
| 156 def AddResult(self, result): | 156 def AddResult(self, result): |
| 157 """Add |result| to the set. | 157 """Add |result| to the set. |
| 158 | 158 |
| 159 Args: | 159 Args: |
| 160 result: An instance of BaseTestResult. | 160 result: An instance of BaseTestResult. |
| 161 """ | 161 """ |
| 162 assert isinstance(result, BaseTestResult) | 162 assert isinstance(result, BaseTestResult) |
| 163 with self._results_lock: | 163 with self._results_lock: |
| 164 self._results.discard(result) |
| 164 self._results.add(result) | 165 self._results.add(result) |
| 165 | 166 |
| 166 def AddResults(self, results): | 167 def AddResults(self, results): |
| 167 """Add |results| to the set. | 168 """Add |results| to the set. |
| 168 | 169 |
| 169 Args: | 170 Args: |
| 170 results: An iterable of BaseTestResult objects. | 171 results: An iterable of BaseTestResult objects. |
| 171 """ | 172 """ |
| 172 with self._results_lock: | 173 with self._results_lock: |
| 173 for t in results: | 174 for t in results: |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 return self._GetType(ResultType.UNKNOWN) | 220 return self._GetType(ResultType.UNKNOWN) |
| 220 | 221 |
| 221 def GetNotPass(self): | 222 def GetNotPass(self): |
| 222 """Get the set of all non-passed test results.""" | 223 """Get the set of all non-passed test results.""" |
| 223 return self.GetAll() - self.GetPass() | 224 return self.GetAll() - self.GetPass() |
| 224 | 225 |
| 225 def DidRunPass(self): | 226 def DidRunPass(self): |
| 226 """Return whether the test run was successful.""" | 227 """Return whether the test run was successful.""" |
| 227 return not self.GetNotPass() - self.GetSkip() | 228 return not self.GetNotPass() - self.GetSkip() |
| 228 | 229 |
| OLD | NEW |