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 class ResultType(object): | 7 class ResultType(object): |
8 """Class enumerating test types.""" | 8 """Class enumerating test types.""" |
9 PASS = 'PASS' | 9 PASS = 'PASS' |
10 SKIP = 'SKIP' | 10 SKIP = 'SKIP' |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 Because we're putting this into a set, this should only be used if moving | 58 Because we're putting this into a set, this should only be used if moving |
59 this test result into another set. | 59 this test result into another set. |
60 """ | 60 """ |
61 self._name = name | 61 self._name = name |
62 | 62 |
63 def GetName(self): | 63 def GetName(self): |
64 """Get the test name.""" | 64 """Get the test name.""" |
65 return self._name | 65 return self._name |
66 | 66 |
| 67 def SetType(self, test_type): |
| 68 """Set the test result type.""" |
| 69 assert test_type in ResultType.GetTypes() |
| 70 self._test_type = test_type |
| 71 |
67 def GetType(self): | 72 def GetType(self): |
68 """Get the test result type.""" | 73 """Get the test result type.""" |
69 return self._test_type | 74 return self._test_type |
70 | 75 |
71 def GetDuration(self): | 76 def GetDuration(self): |
72 """Get the test duration.""" | 77 """Get the test duration.""" |
73 return self._duration | 78 return self._duration |
74 | 79 |
75 def GetLog(self): | 80 def GetLog(self): |
76 """Get the test log.""" | 81 """Get the test log.""" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 return self._GetType(ResultType.UNKNOWN) | 203 return self._GetType(ResultType.UNKNOWN) |
199 | 204 |
200 def GetNotPass(self): | 205 def GetNotPass(self): |
201 """Get the set of all non-passed test results.""" | 206 """Get the set of all non-passed test results.""" |
202 return self.GetAll() - self.GetPass() | 207 return self.GetAll() - self.GetPass() |
203 | 208 |
204 def DidRunPass(self): | 209 def DidRunPass(self): |
205 """Return whether the test run was successful.""" | 210 """Return whether the test run was successful.""" |
206 return not self.GetNotPass() - self.GetSkip() | 211 return not self.GetNotPass() - self.GetSkip() |
207 | 212 |
OLD | NEW |