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 time | 10 import time |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 logging.info('Taking screenshot named %s', screenshot_name) | 119 logging.info('Taking screenshot named %s', screenshot_name) |
120 self.adb.TakeScreenshot(screenshot_name) | 120 self.adb.TakeScreenshot(screenshot_name) |
121 | 121 |
122 def SetUp(self): | 122 def SetUp(self): |
123 """Sets up the test harness and device before all tests are run.""" | 123 """Sets up the test harness and device before all tests are run.""" |
124 super(TestRunner, self).SetUp() | 124 super(TestRunner, self).SetUp() |
125 if not self.adb.IsRootEnabled(): | 125 if not self.adb.IsRootEnabled(): |
126 logging.warning('Unable to enable java asserts for %s, non rooted device', | 126 logging.warning('Unable to enable java asserts for %s, non rooted device', |
127 self.device) | 127 self.device) |
128 else: | 128 else: |
129 if self.adb.SetJavaAssertsEnabled( | 129 if self.adb.SetJavaAssertsEnabled(True): |
130 enable=not self.options.disable_assertions): | |
131 self.adb.Reboot(full_reboot=False) | 130 self.adb.Reboot(full_reboot=False) |
132 | 131 |
133 # We give different default value to launch HTTP server based on shard index | 132 # We give different default value to launch HTTP server based on shard index |
134 # because it may have race condition when multiple processes are trying to | 133 # because it may have race condition when multiple processes are trying to |
135 # launch lighttpd with same port at same time. | 134 # launch lighttpd with same port at same time. |
136 http_server_ports = self.LaunchTestHttpServer( | 135 http_server_ports = self.LaunchTestHttpServer( |
137 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) | 136 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) |
138 if self.ports_to_forward: | 137 if self.ports_to_forward: |
139 self._ForwardPorts([(port, port) for port in self.ports_to_forward]) | 138 self._ForwardPorts([(port, port) for port in self.ports_to_forward]) |
140 self.flags.AddFlags(['--enable-test-intents']) | 139 self.flags.AddFlags(['--enable-test-intents']) |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 duration_ms = 0 | 336 duration_ms = 0 |
338 message = str(e) | 337 message = str(e) |
339 if not message: | 338 if not message: |
340 message = 'No information.' | 339 message = 'No information.' |
341 results.AddResult(test_result.InstrumentationTestResult( | 340 results.AddResult(test_result.InstrumentationTestResult( |
342 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, | 341 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, |
343 log=message)) | 342 log=message)) |
344 raw_result = None | 343 raw_result = None |
345 self.TestTeardown(test, raw_result) | 344 self.TestTeardown(test, raw_result) |
346 return (results, None if results.DidRunPass() else test) | 345 return (results, None if results.DidRunPass() else test) |
OLD | NEW |