| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 test_type: Type of the test result as defined in ResultType. | 49 test_type: Type of the test result as defined in ResultType. |
| 50 duration: Time it took for the test to run in milliseconds. | 50 duration: Time it took for the test to run in milliseconds. |
| 51 log: An optional string listing any errors. | 51 log: An optional string listing any errors. |
| 52 """ | 52 """ |
| 53 assert name | 53 assert name |
| 54 assert test_type in ResultType.GetTypes() | 54 assert test_type in ResultType.GetTypes() |
| 55 self._name = name | 55 self._name = name |
| 56 self._test_type = test_type | 56 self._test_type = test_type |
| 57 self._duration = duration | 57 self._duration = duration |
| 58 self._log = log | 58 self._log = log |
| 59 self._tombstones = None | 59 self._tombstones_url = None |
| 60 self._logcat_url = None | 60 self._logcat_url = None |
| 61 | 61 |
| 62 def __str__(self): | 62 def __str__(self): |
| 63 return self._name | 63 return self._name |
| 64 | 64 |
| 65 def __repr__(self): | 65 def __repr__(self): |
| 66 return self._name | 66 return self._name |
| 67 | 67 |
| 68 def __cmp__(self, other): | 68 def __cmp__(self, other): |
| 69 # pylint: disable=W0212 | 69 # pylint: disable=W0212 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 98 return self._duration | 98 return self._duration |
| 99 | 99 |
| 100 def SetLog(self, log): | 100 def SetLog(self, log): |
| 101 """Set the test log.""" | 101 """Set the test log.""" |
| 102 self._log = log | 102 self._log = log |
| 103 | 103 |
| 104 def GetLog(self): | 104 def GetLog(self): |
| 105 """Get the test log.""" | 105 """Get the test log.""" |
| 106 return self._log | 106 return self._log |
| 107 | 107 |
| 108 def SetTombstones(self, tombstones): | 108 def SetTombstonesUrl(self, tombstones_url): |
| 109 self._tombstones = tombstones | 109 self._tombstones_url = tombstones_url |
| 110 | 110 |
| 111 def GetTombstones(self): | 111 def GetTombstonesUrl(self): |
| 112 return self._tombstones | 112 return self._tombstones_url |
| 113 | 113 |
| 114 def SetLogcatUrl(self, logcat_url): | 114 def SetLogcatUrl(self, logcat_url): |
| 115 self._logcat_url = logcat_url | 115 self._logcat_url = logcat_url |
| 116 | 116 |
| 117 def GetLogcatUrl(self): | 117 def GetLogcatUrl(self): |
| 118 return self._logcat_url | 118 return self._logcat_url |
| 119 | 119 |
| 120 class TestRunResults(object): | 120 class TestRunResults(object): |
| 121 """Set of results for a test run.""" | 121 """Set of results for a test run.""" |
| 122 | 122 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 return self._GetType(ResultType.UNKNOWN) | 249 return self._GetType(ResultType.UNKNOWN) |
| 250 | 250 |
| 251 def GetNotPass(self): | 251 def GetNotPass(self): |
| 252 """Get the set of all non-passed test results.""" | 252 """Get the set of all non-passed test results.""" |
| 253 return self.GetAll() - self.GetPass() | 253 return self.GetAll() - self.GetPass() |
| 254 | 254 |
| 255 def DidRunPass(self): | 255 def DidRunPass(self): |
| 256 """Return whether the test run was successful.""" | 256 """Return whether the test run was successful.""" |
| 257 return not self.GetNotPass() - self.GetSkip() | 257 return not self.GetNotPass() - self.GetSkip() |
| 258 | 258 |
| OLD | NEW |