| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 self.device.TakeScreenshot(screenshot_name) | 89 self.device.TakeScreenshot(screenshot_name) |
| 90 | 90 |
| 91 def SetUp(self): | 91 def SetUp(self): |
| 92 """Sets up the test harness and device before all tests are run.""" | 92 """Sets up the test harness and device before all tests are run.""" |
| 93 super(TestRunner, self).SetUp() | 93 super(TestRunner, self).SetUp() |
| 94 if not self.device.HasRoot(): | 94 if not self.device.HasRoot(): |
| 95 logging.warning('Unable to enable java asserts for %s, non rooted device', | 95 logging.warning('Unable to enable java asserts for %s, non rooted device', |
| 96 str(self.device)) | 96 str(self.device)) |
| 97 else: | 97 else: |
| 98 if self.device.SetJavaAsserts(self.options.set_asserts): | 98 if self.device.SetJavaAsserts(self.options.set_asserts): |
| 99 # TODO(jbudorick) How to best do shell restart after the |
| 100 # android_commands refactor? |
| 99 self.device.RunShellCommand('stop') | 101 self.device.RunShellCommand('stop') |
| 100 self.device.RunShellCommand('start') | 102 self.device.RunShellCommand('start') |
| 101 self.device.WaitUntilFullyBooted() | 103 self.device.WaitUntilFullyBooted() |
| 102 | 104 |
| 103 # We give different default value to launch HTTP server based on shard index | 105 # We give different default value to launch HTTP server based on shard index |
| 104 # because it may have race condition when multiple processes are trying to | 106 # because it may have race condition when multiple processes are trying to |
| 105 # launch lighttpd with same port at same time. | 107 # launch lighttpd with same port at same time. |
| 106 self.LaunchTestHttpServer( | 108 self.LaunchTestHttpServer( |
| 107 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) | 109 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) |
| 108 if self.flags: | 110 if self.flags: |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 except device_errors.CommandTimeoutError as e: | 365 except device_errors.CommandTimeoutError as e: |
| 364 results.AddResult(test_result.InstrumentationTestResult( | 366 results.AddResult(test_result.InstrumentationTestResult( |
| 365 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, | 367 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, |
| 366 log=str(e) or 'No information')) | 368 log=str(e) or 'No information')) |
| 367 except device_errors.DeviceUnreachableError as e: | 369 except device_errors.DeviceUnreachableError as e: |
| 368 results.AddResult(test_result.InstrumentationTestResult( | 370 results.AddResult(test_result.InstrumentationTestResult( |
| 369 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, | 371 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, |
| 370 log=str(e) or 'No information')) | 372 log=str(e) or 'No information')) |
| 371 self.TestTeardown(test, results) | 373 self.TestTeardown(test, results) |
| 372 return (results, None if results.DidRunPass() else test) | 374 return (results, None if results.DidRunPass() else test) |
| OLD | NEW |