| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 contextlib | 5 import contextlib |
| 6 import datetime | 6 import datetime |
| 7 import json | 7 import json |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import urllib | 10 import urllib |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 def authorize_adb_devices(self): | 306 def authorize_adb_devices(self): |
| 307 script = self.package_repo_resource( | 307 script = self.package_repo_resource( |
| 308 'scripts', 'slave', 'android', 'authorize_adb_devices.py') | 308 'scripts', 'slave', 'android', 'authorize_adb_devices.py') |
| 309 args = ['--verbose', '--adb-path', self.m.adb.adb_path()] | 309 args = ['--verbose', '--adb-path', self.m.adb.adb_path()] |
| 310 return self.m.python('authorize_adb_devices', script, args, infra_step=True, | 310 return self.m.python('authorize_adb_devices', script, args, infra_step=True, |
| 311 env=self.m.chromium.get_env()) | 311 env=self.m.chromium.get_env()) |
| 312 | 312 |
| 313 def detect_and_setup_devices(self, restart_usb=False, skip_wipe=False, | 313 def detect_and_setup_devices(self, restart_usb=False, skip_wipe=False, |
| 314 disable_location=False, min_battery_level=None, | 314 disable_location=False, min_battery_level=None, |
| 315 disable_network=False, disable_java_debug=False, | 315 disable_network=False, disable_java_debug=False, |
| 316 reboot_timeout=None, max_battery_temp=None): | 316 max_battery_temp=None): |
| 317 self.authorize_adb_devices() | 317 self.authorize_adb_devices() |
| 318 self.device_status_check(restart_usb=restart_usb) | 318 self.device_status_check(restart_usb=restart_usb) |
| 319 self.provision_devices( | 319 self.provision_devices( |
| 320 skip_wipe=skip_wipe, disable_location=disable_location, | 320 skip_wipe=skip_wipe, disable_location=disable_location, |
| 321 min_battery_level=min_battery_level, disable_network=disable_network, | 321 min_battery_level=min_battery_level, disable_network=disable_network, |
| 322 disable_java_debug=disable_java_debug, reboot_timeout=reboot_timeout, | 322 disable_java_debug=disable_java_debug, max_battery_temp=max_battery_temp) |
| 323 max_battery_temp=max_battery_temp) | |
| 324 | 323 |
| 325 @property | 324 @property |
| 326 def blacklist_file(self): | 325 def blacklist_file(self): |
| 327 return self.out_path.join('bad_devices.json') | 326 return self.out_path.join('bad_devices.json') |
| 328 | 327 |
| 329 def device_status_check(self, restart_usb=False, **kwargs): | 328 def device_status_check(self, restart_usb=False, **kwargs): |
| 330 # TODO(phajdan.jr): Remove path['build'] usage, http://crbug.com/437264 . | 329 # TODO(phajdan.jr): Remove path['build'] usage, http://crbug.com/437264 . |
| 331 devices_path = self.m.path['build'].join('site_config', '.known_devices') | 330 devices_path = self.m.path['build'].join('site_config', '.known_devices') |
| 332 args = [ | 331 args = [ |
| 333 '--json-output', self.m.json.output(), | 332 '--json-output', self.m.json.output(), |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 } | 419 } |
| 421 link = ('https://code.google.com/p/chromium/issues/entry?%s' % | 420 link = ('https://code.google.com/p/chromium/issues/entry?%s' % |
| 422 urllib.urlencode(params)) | 421 urllib.urlencode(params)) |
| 423 f.result.presentation.links.update({ | 422 f.result.presentation.links.update({ |
| 424 'report a bug': link | 423 'report a bug': link |
| 425 }) | 424 }) |
| 426 raise | 425 raise |
| 427 | 426 |
| 428 def provision_devices(self, skip_wipe=False, disable_location=False, | 427 def provision_devices(self, skip_wipe=False, disable_location=False, |
| 429 min_battery_level=None, disable_network=False, | 428 min_battery_level=None, disable_network=False, |
| 430 disable_java_debug=False, reboot_timeout=None, | 429 disable_java_debug=False, max_battery_temp=None, |
| 431 max_battery_temp=None, disable_system_chrome=False, | 430 disable_system_chrome=False, |
| 432 remove_system_webview=False, emulators=False, | 431 remove_system_webview=False, emulators=False, |
| 433 **kwargs): | 432 **kwargs): |
| 434 args = [ | 433 args = [ |
| 435 '-t', self.m.chromium.c.BUILD_CONFIG, | 434 '-t', self.m.chromium.c.BUILD_CONFIG, |
| 436 '--blacklist-file', self.blacklist_file, | 435 '--blacklist-file', self.blacklist_file, |
| 437 '--output-device-blacklist', self.m.json.output(add_json_log=False), | 436 '--output-device-blacklist', self.m.json.output(add_json_log=False), |
| 438 ] | 437 ] |
| 439 if skip_wipe: | 438 if skip_wipe: |
| 440 args.append('--skip-wipe') | 439 args.append('--skip-wipe') |
| 441 if disable_location: | 440 if disable_location: |
| 442 args.append('--disable-location') | 441 args.append('--disable-location') |
| 443 if reboot_timeout is not None: | |
| 444 assert isinstance(reboot_timeout, int) | |
| 445 assert reboot_timeout > 0 | |
| 446 args.extend(['--reboot-timeout', reboot_timeout]) | |
| 447 if min_battery_level is not None: | 442 if min_battery_level is not None: |
| 448 assert isinstance(min_battery_level, int) | 443 assert isinstance(min_battery_level, int) |
| 449 assert min_battery_level >= 0 | 444 assert min_battery_level >= 0 |
| 450 assert min_battery_level <= 100 | 445 assert min_battery_level <= 100 |
| 451 args.extend(['--min-battery-level', min_battery_level]) | 446 args.extend(['--min-battery-level', min_battery_level]) |
| 452 if disable_network: | 447 if disable_network: |
| 453 args.append('--disable-network') | 448 args.append('--disable-network') |
| 454 if disable_java_debug: | 449 if disable_java_debug: |
| 455 args.append('--disable-java-debug') | 450 args.append('--disable-java-debug') |
| 456 if max_battery_temp: | 451 if max_battery_temp: |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 script = self.c.test_runner | 1252 script = self.c.test_runner |
| 1258 if wrapper_script_suite_name: | 1253 if wrapper_script_suite_name: |
| 1259 script = self.m.chromium.output_dir.join('bin', 'run_%s' % | 1254 script = self.m.chromium.output_dir.join('bin', 'run_%s' % |
| 1260 wrapper_script_suite_name) | 1255 wrapper_script_suite_name) |
| 1261 else: | 1256 else: |
| 1262 env = kwargs.get('env', {}) | 1257 env = kwargs.get('env', {}) |
| 1263 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', | 1258 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', |
| 1264 self.m.chromium.output_dir) | 1259 self.m.chromium.output_dir) |
| 1265 kwargs['env'] = env | 1260 kwargs['env'] = env |
| 1266 return self.m.python(step_name, script, args, **kwargs) | 1261 return self.m.python(step_name, script, args, **kwargs) |
| OLD | NEW |