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 24 matching lines...) Expand all Loading... |
35 duration: Time it took for the test to run in milliseconds. | 35 duration: Time it took for the test to run in milliseconds. |
36 log: An optional string listing any errors. | 36 log: An optional string listing any errors. |
37 """ | 37 """ |
38 assert name | 38 assert name |
39 assert test_type in ResultType.GetTypes() | 39 assert test_type in ResultType.GetTypes() |
40 self._name = name | 40 self._name = name |
41 self._test_type = test_type | 41 self._test_type = test_type |
42 self._duration = duration | 42 self._duration = duration |
43 self._log = log | 43 self._log = log |
44 self._tombstones = None | 44 self._tombstones = None |
| 45 self._logcat_url = None |
45 | 46 |
46 def __str__(self): | 47 def __str__(self): |
47 return self._name | 48 return self._name |
48 | 49 |
49 def __repr__(self): | 50 def __repr__(self): |
50 return self._name | 51 return self._name |
51 | 52 |
52 def __cmp__(self, other): | 53 def __cmp__(self, other): |
53 # pylint: disable=W0212 | 54 # pylint: disable=W0212 |
54 return cmp(self._name, other._name) | 55 return cmp(self._name, other._name) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 def GetLog(self): | 89 def GetLog(self): |
89 """Get the test log.""" | 90 """Get the test log.""" |
90 return self._log | 91 return self._log |
91 | 92 |
92 def SetTombstones(self, tombstones): | 93 def SetTombstones(self, tombstones): |
93 self._tombstones = tombstones | 94 self._tombstones = tombstones |
94 | 95 |
95 def GetTombstones(self): | 96 def GetTombstones(self): |
96 return self._tombstones | 97 return self._tombstones |
97 | 98 |
| 99 def SetLogcatUrl(self, logcat_url): |
| 100 self._logcat_url = logcat_url |
| 101 |
| 102 def GetLogcatUrl(self): |
| 103 return self._logcat_url |
| 104 |
98 class TestRunResults(object): | 105 class TestRunResults(object): |
99 """Set of results for a test run.""" | 106 """Set of results for a test run.""" |
100 | 107 |
101 def __init__(self): | 108 def __init__(self): |
102 self._results = set() | 109 self._results = set() |
103 self._results_lock = threading.RLock() | 110 self._results_lock = threading.RLock() |
104 | 111 |
105 def GetLogs(self): | 112 def GetLogs(self): |
106 """Get the string representation of all test logs.""" | 113 """Get the string representation of all test logs.""" |
107 with self._results_lock: | 114 with self._results_lock: |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 return self._GetType(ResultType.UNKNOWN) | 234 return self._GetType(ResultType.UNKNOWN) |
228 | 235 |
229 def GetNotPass(self): | 236 def GetNotPass(self): |
230 """Get the set of all non-passed test results.""" | 237 """Get the set of all non-passed test results.""" |
231 return self.GetAll() - self.GetPass() | 238 return self.GetAll() - self.GetPass() |
232 | 239 |
233 def DidRunPass(self): | 240 def DidRunPass(self): |
234 """Return whether the test run was successful.""" | 241 """Return whether the test run was successful.""" |
235 return not self.GetNotPass() - self.GetSkip() | 242 return not self.GetNotPass() - self.GetSkip() |
236 | 243 |
OLD | NEW |