| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Class for running instrumentation tests on a single device.""" | 5 """Class for running instrumentation tests on a single device.""" |
| 6 | 6 |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import sys | 10 import sys |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 logging.error('Could not find result for test: %s', test) | 329 logging.error('Could not find result for test: %s', test) |
| 330 return test_result.InstrumentationTestResult( | 330 return test_result.InstrumentationTestResult( |
| 331 test, base_test_result.ResultType.UNKNOWN, start_ms, duration_ms) | 331 test, base_test_result.ResultType.UNKNOWN, start_ms, duration_ms) |
| 332 | 332 |
| 333 #override | 333 #override |
| 334 def RunTest(self, test): | 334 def RunTest(self, test): |
| 335 results = base_test_result.TestRunResults() | 335 results = base_test_result.TestRunResults() |
| 336 timeout = (self._GetIndividualTestTimeoutSecs(test) * | 336 timeout = (self._GetIndividualTestTimeoutSecs(test) * |
| 337 self._GetIndividualTestTimeoutScale(test) * | 337 self._GetIndividualTestTimeoutScale(test) * |
| 338 self.tool.GetTimeoutScale()) | 338 self.tool.GetTimeoutScale()) |
| 339 if (self.device.build_version_sdk | |
| 340 < constants.ANDROID_SDK_VERSION_CODES.JELLY_BEAN): | |
| 341 timeout *= 10 | |
| 342 | 339 |
| 343 start_ms = 0 | 340 start_ms = 0 |
| 344 duration_ms = 0 | 341 duration_ms = 0 |
| 345 try: | 342 try: |
| 346 self.TestSetup(test) | 343 self.TestSetup(test) |
| 347 | 344 |
| 348 time_ms = lambda: int(time.time() * 1000) | 345 time_ms = lambda: int(time.time() * 1000) |
| 349 start_ms = time_ms() | 346 start_ms = time_ms() |
| 350 raw_output = self._RunTest(test, timeout) | 347 raw_output = self._RunTest(test, timeout) |
| 351 duration_ms = time_ms() - start_ms | 348 duration_ms = time_ms() - start_ms |
| (...skipping 10 matching lines...) Expand all Loading... |
| 362 except device_errors.CommandTimeoutError as e: | 359 except device_errors.CommandTimeoutError as e: |
| 363 results.AddResult(test_result.InstrumentationTestResult( | 360 results.AddResult(test_result.InstrumentationTestResult( |
| 364 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, | 361 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, |
| 365 log=str(e) or 'No information')) | 362 log=str(e) or 'No information')) |
| 366 except device_errors.DeviceUnreachableError as e: | 363 except device_errors.DeviceUnreachableError as e: |
| 367 results.AddResult(test_result.InstrumentationTestResult( | 364 results.AddResult(test_result.InstrumentationTestResult( |
| 368 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, | 365 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, |
| 369 log=str(e) or 'No information')) | 366 log=str(e) or 'No information')) |
| 370 self.TestTeardown(test, results) | 367 self.TestTeardown(test, results) |
| 371 return (results, None if results.DidRunPass() else test) | 368 return (results, None if results.DidRunPass() else test) |
| OLD | NEW |