| 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 """Runs the Java tests. See more information on run_instrumentation_tests.py.""" | 5 """Runs the Java tests. See more information on run_instrumentation_tests.py.""" |
| 6 | 6 |
| 7 import fnmatch | 7 import fnmatch |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 'out_screenshots') | 241 'out_screenshots') |
| 242 if not os.path.exists(screenshot_path): | 242 if not os.path.exists(screenshot_path): |
| 243 os.mkdir(screenshot_path) | 243 os.mkdir(screenshot_path) |
| 244 screenshot_name = os.path.join(screenshot_path, test + '.png') | 244 screenshot_name = os.path.join(screenshot_path, test + '.png') |
| 245 logging.info('Taking screenshot named %s', screenshot_name) | 245 logging.info('Taking screenshot named %s', screenshot_name) |
| 246 cmd_helper.RunCmd([screenshot_tool, '-s', self.device, screenshot_name]) | 246 cmd_helper.RunCmd([screenshot_tool, '-s', self.device, screenshot_name]) |
| 247 | 247 |
| 248 def SetUp(self): | 248 def SetUp(self): |
| 249 """Sets up the test harness and device before all tests are run.""" | 249 """Sets up the test harness and device before all tests are run.""" |
| 250 super(TestRunner, self).SetUp() | 250 super(TestRunner, self).SetUp() |
| 251 if self.adb.SetJavaAssertsEnabled(enable=True): | 251 if not self.adb.IsRootEnabled(): |
| 252 self.adb.Reboot(full_reboot=False) | 252 logging.warning('Unable to enable java asserts for %s, non rooted device', |
| 253 self.device) |
| 254 else: |
| 255 if self.adb.SetJavaAssertsEnabled(enable=True): |
| 256 self.adb.Reboot(full_reboot=False) |
| 253 | 257 |
| 254 # We give different default value to launch HTTP server based on shard index | 258 # We give different default value to launch HTTP server based on shard index |
| 255 # because it may have race condition when multiple processes are trying to | 259 # because it may have race condition when multiple processes are trying to |
| 256 # launch lighttpd with same port at same time. | 260 # launch lighttpd with same port at same time. |
| 257 # This line *must* come before the forwarding below, as it nukes all | 261 # This line *must* come before the forwarding below, as it nukes all |
| 258 # the other forwarders. A more comprehensive fix might be to pull the | 262 # the other forwarders. A more comprehensive fix might be to pull the |
| 259 # forwarder-killing line up to here, but that might violate assumptions | 263 # forwarder-killing line up to here, but that might violate assumptions |
| 260 # implicit in other places. | 264 # implicit in other places. |
| 261 self.LaunchTestHttpServer(os.path.join(constants.CHROME_DIR), | 265 self.LaunchTestHttpServer(os.path.join(constants.CHROME_DIR), |
| 262 (constants.LIGHTTPD_RANDOM_PORT_FIRST + | 266 (constants.LIGHTTPD_RANDOM_PORT_FIRST + |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 if (len(attached_devices) > 1 and | 585 if (len(attached_devices) > 1 and |
| 582 not coverage and | 586 not coverage and |
| 583 not options.wait_for_debugger): | 587 not options.wait_for_debugger): |
| 584 sharder = TestSharder(attached_devices, options, tests, apks) | 588 sharder = TestSharder(attached_devices, options, tests, apks) |
| 585 test_results = sharder.RunShardedTests() | 589 test_results = sharder.RunShardedTests() |
| 586 else: | 590 else: |
| 587 runner = TestRunner(options, attached_devices[0], tests, coverage, 0, apks, | 591 runner = TestRunner(options, attached_devices[0], tests, coverage, 0, apks, |
| 588 []) | 592 []) |
| 589 test_results = runner.Run() | 593 test_results = runner.Run() |
| 590 return test_results | 594 return test_results |
| OLD | NEW |