| 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 import time | 7 import time |
| 8 | 8 |
| 9 from devil.android import device_errors | 9 from devil.android import device_errors |
| 10 from pylib import flag_changer | 10 from pylib import flag_changer |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 logging.debug(' %s', l) | 160 logging.debug(' %s', l) |
| 161 | 161 |
| 162 result_code, result_bundle, statuses = ( | 162 result_code, result_bundle, statuses = ( |
| 163 self._test_instance.ParseAmInstrumentRawOutput(output)) | 163 self._test_instance.ParseAmInstrumentRawOutput(output)) |
| 164 results = self._test_instance.GenerateTestResults( | 164 results = self._test_instance.GenerateTestResults( |
| 165 result_code, result_bundle, statuses, start_ms, duration_ms) | 165 result_code, result_bundle, statuses, start_ms, duration_ms) |
| 166 if DidPackageCrashOnDevice(self._test_instance.test_package, device): | 166 if DidPackageCrashOnDevice(self._test_instance.test_package, device): |
| 167 for r in results: | 167 for r in results: |
| 168 if r.GetType() == base_test_result.ResultType.UNKNOWN: | 168 if r.GetType() == base_test_result.ResultType.UNKNOWN: |
| 169 r.SetType(base_test_result.ResultType.CRASH) | 169 r.SetType(base_test_result.ResultType.CRASH) |
| 170 # TODO(jbudorick): ClearApplicationState on failure before switching |
| 171 # instrumentation tests to platform mode. |
| 170 return results | 172 return results |
| 171 | 173 |
| 172 #override | 174 #override |
| 173 def _ShouldShard(self): | 175 def _ShouldShard(self): |
| 174 return True | 176 return True |
| 175 | 177 |
| 176 @staticmethod | 178 @staticmethod |
| 177 def _GetTimeoutFromAnnotations(annotations, test_name): | 179 def _GetTimeoutFromAnnotations(annotations, test_name): |
| 178 for k, v in TIMEOUT_ANNOTATIONS: | 180 for k, v in TIMEOUT_ANNOTATIONS: |
| 179 if k in annotations: | 181 if k in annotations: |
| 180 timeout = v | 182 timeout = v |
| 181 break | 183 break |
| 182 else: | 184 else: |
| 183 logging.warning('Using default 1 minute timeout for %s', test_name) | 185 logging.warning('Using default 1 minute timeout for %s', test_name) |
| 184 timeout = 60 | 186 timeout = 60 |
| 185 | 187 |
| 186 try: | 188 try: |
| 187 scale = int(annotations.get('TimeoutScale', 1)) | 189 scale = int(annotations.get('TimeoutScale', 1)) |
| 188 except ValueError as e: | 190 except ValueError as e: |
| 189 logging.warning("Non-integer value of TimeoutScale ignored. (%s)", str(e)) | 191 logging.warning("Non-integer value of TimeoutScale ignored. (%s)", str(e)) |
| 190 scale = 1 | 192 scale = 1 |
| 191 timeout *= scale | 193 timeout *= scale |
| 192 | 194 |
| 193 return timeout | 195 return timeout |
| 194 | 196 |
| OLD | NEW |