Chromium Code Reviews| 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): |
| 11 """Class enumerating test types.""" | 11 """Class enumerating test types.""" |
| 12 # The test passed. | |
| 12 PASS = 'PASS' | 13 PASS = 'PASS' |
| 14 | |
| 15 # The test was intentionally skipped. | |
| 13 SKIP = 'SKIP' | 16 SKIP = 'SKIP' |
| 17 | |
| 18 # The test failed. | |
| 14 FAIL = 'FAIL' | 19 FAIL = 'FAIL' |
| 20 | |
| 21 # The test caused the containing process to crash. | |
| 15 CRASH = 'CRASH' | 22 CRASH = 'CRASH' |
| 23 | |
| 24 # The test timed out. | |
| 16 TIMEOUT = 'TIMEOUT' | 25 TIMEOUT = 'TIMEOUT' |
| 26 | |
| 27 # The test ran, but we couldn't determine what happened. | |
| 17 UNKNOWN = 'UNKNOWN' | 28 UNKNOWN = 'UNKNOWN' |
| 18 | 29 |
| 30 # The test did not run. | |
| 31 NOTRUN = 'NOTRUN' | |
| 32 | |
| 19 @staticmethod | 33 @staticmethod |
| 20 def GetTypes(): | 34 def GetTypes(): |
| 21 """Get a list of all test types.""" | 35 """Get a list of all test types.""" |
| 22 return [ResultType.PASS, ResultType.SKIP, ResultType.FAIL, | 36 return [ResultType.PASS, ResultType.SKIP, ResultType.FAIL, |
| 23 ResultType.CRASH, ResultType.TIMEOUT, ResultType.UNKNOWN] | 37 ResultType.CRASH, ResultType.TIMEOUT, ResultType.UNKNOWN, |
| 38 ResultType.NOTRUN] | |
|
shenghuazhang
2016/12/01 19:46:40
Seems like the 'NOTRUN' ResultType isn't used by a
jbudorick
2016/12/02 01:45:21
NOTRUN was more functional in an earlier patchset;
| |
| 24 | 39 |
| 25 | 40 |
| 26 class BaseTestResult(object): | 41 class BaseTestResult(object): |
| 27 """Base class for a single test result.""" | 42 """Base class for a single test result.""" |
| 28 | 43 |
| 29 def __init__(self, name, test_type, duration=0, log=''): | 44 def __init__(self, name, test_type, duration=0, log=''): |
| 30 """Construct a BaseTestResult. | 45 """Construct a BaseTestResult. |
| 31 | 46 |
| 32 Args: | 47 Args: |
| 33 name: Name of the test which defines uniqueness. | 48 name: Name of the test which defines uniqueness. |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 227 return self._GetType(ResultType.UNKNOWN) | 242 return self._GetType(ResultType.UNKNOWN) |
| 228 | 243 |
| 229 def GetNotPass(self): | 244 def GetNotPass(self): |
| 230 """Get the set of all non-passed test results.""" | 245 """Get the set of all non-passed test results.""" |
| 231 return self.GetAll() - self.GetPass() | 246 return self.GetAll() - self.GetPass() |
| 232 | 247 |
| 233 def DidRunPass(self): | 248 def DidRunPass(self): |
| 234 """Return whether the test run was successful.""" | 249 """Return whether the test run was successful.""" |
| 235 return not self.GetNotPass() - self.GetSkip() | 250 return not self.GetNotPass() - self.GetSkip() |
| 236 | 251 |
| OLD | NEW |