OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import logging | 5 import logging |
6 import re | 6 import re |
7 | 7 |
8 # http://developer.android.com/reference/android/test/InstrumentationTestRunner.
html | 8 # http://developer.android.com/reference/android/test/InstrumentationTestRunner.
html |
9 STATUS_CODE_START = 1 | 9 STATUS_CODE_START = 1 |
10 STATUS_CODE_OK = 0 | 10 STATUS_CODE_OK = 0 |
11 STATUS_CODE_ERROR = -1 | 11 STATUS_CODE_ERROR = -1 |
12 STATUS_CODE_FAILURE = -2 | 12 STATUS_CODE_FAILURE = -2 |
13 | 13 |
| 14 # AndroidJUnitRunner would status output -3 to indicate a test is skipped |
| 15 STATUS_CODE_SKIP = -3 |
| 16 |
14 # http://developer.android.com/reference/android/app/Activity.html | 17 # http://developer.android.com/reference/android/app/Activity.html |
15 RESULT_CODE_OK = -1 | 18 RESULT_CODE_OK = -1 |
16 RESULT_CODE_CANCELED = 0 | 19 RESULT_CODE_CANCELED = 0 |
17 | 20 |
18 _INSTR_LINE_RE = re.compile(r'^\s*INSTRUMENTATION_([A-Z_]+): (.*)$') | 21 _INSTR_LINE_RE = re.compile(r'^\s*INSTRUMENTATION_([A-Z_]+): (.*)$') |
19 | 22 |
20 | 23 |
21 class InstrumentationParser(object): | 24 class InstrumentationParser(object): |
22 | 25 |
23 def __init__(self, stream): | 26 def __init__(self, stream): |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 may be None if no instrumentation result was found in the output. | 90 may be None if no instrumentation result was found in the output. |
88 | 91 |
89 Raises: | 92 Raises: |
90 AssertionError if attempting to get the instrumentation result before | 93 AssertionError if attempting to get the instrumentation result before |
91 exhausting |IterStatus| first. | 94 exhausting |IterStatus| first. |
92 """ | 95 """ |
93 assert self._bundle is not None, ( | 96 assert self._bundle is not None, ( |
94 'The IterStatus generator must be exhausted before reading the final' | 97 'The IterStatus generator must be exhausted before reading the final' |
95 ' instrumentation result.') | 98 ' instrumentation result.') |
96 return self._code, self._bundle | 99 return self._code, self._bundle |
OLD | NEW |