OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Launches Android Virtual Devices with a set configuration for testing Chrome. | 6 """Launches Android Virtual Devices with a set configuration for testing Chrome. |
7 | 7 |
8 The script will launch a specified number of Android Virtual Devices (AVD's). | 8 The script will launch a specified number of Android Virtual Devices (AVD's). |
9 """ | 9 """ |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 'install_emulator_deps.py.') | 63 'install_emulator_deps.py.') |
64 return 1 | 64 return 1 |
65 | 65 |
66 # If AVD is specified, check that the SDK has the required target. If not, | 66 # If AVD is specified, check that the SDK has the required target. If not, |
67 # check that the SDK has the desired target for the temporary AVD's. | 67 # check that the SDK has the desired target for the temporary AVD's. |
68 api_level = options.api_level | 68 api_level = options.api_level |
69 if options.name: | 69 if options.name: |
70 android = os.path.join(constants.EMULATOR_SDK_ROOT, 'sdk', 'tools', | 70 android = os.path.join(constants.EMULATOR_SDK_ROOT, 'sdk', 'tools', |
71 'android') | 71 'android') |
72 avds_output = cmd_helper.GetCmdOutput([android, 'list', 'avd']) | 72 avds_output = cmd_helper.GetCmdOutput([android, 'list', 'avd']) |
73 names = re.findall('Name: (\w+)', avds_output) | 73 names = re.findall(r'Name: (\w+)', avds_output) |
74 api_levels = re.findall('API level (\d+)', avds_output) | 74 api_levels = re.findall(r'API level (\d+)', avds_output) |
75 try: | 75 try: |
76 avd_index = names.index(options.name) | 76 avd_index = names.index(options.name) |
77 except ValueError: | 77 except ValueError: |
78 logging.critical('ERROR: Specified AVD %s does not exist.' % options.name) | 78 logging.critical('ERROR: Specified AVD %s does not exist.' % options.name) |
79 return 1 | 79 return 1 |
80 api_level = int(api_levels[avd_index]) | 80 api_level = int(api_levels[avd_index]) |
81 | 81 |
82 if not install_emulator_deps.CheckSDKPlatform(api_level): | 82 if not install_emulator_deps.CheckSDKPlatform(api_level): |
83 logging.critical('ERROR: Emulator SDK missing required target for API %d. ' | 83 logging.critical('ERROR: Emulator SDK missing required target for API %d. ' |
84 'Run install_emulator_deps.py.') | 84 'Run install_emulator_deps.py.') |
85 return 1 | 85 return 1 |
86 | 86 |
87 if options.name: | 87 if options.name: |
88 emulator.LaunchEmulator(options.name, options.abi) | 88 emulator.LaunchEmulator(options.name, options.abi) |
89 else: | 89 else: |
90 emulator.LaunchTempEmulators(options.emulator_count, options.abi, | 90 emulator.LaunchTempEmulators(options.emulator_count, options.abi, |
91 options.api_level, True) | 91 options.api_level, True) |
92 | 92 |
93 | 93 |
94 | 94 |
95 if __name__ == '__main__': | 95 if __name__ == '__main__': |
96 sys.exit(main(sys.argv)) | 96 sys.exit(main(sys.argv)) |
OLD | NEW |