| 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 |
| 11 import argparse | 11 import argparse |
| 12 import logging | 12 import logging |
| 13 import os | 13 import os |
| 14 import re | 14 import re |
| 15 import sys | 15 import sys |
| 16 | 16 |
| 17 import devil_chromium |
| 17 import install_emulator_deps | 18 import install_emulator_deps |
| 18 | 19 |
| 19 from devil.utils import cmd_helper | 20 from devil.utils import cmd_helper |
| 20 from pylib import constants | 21 from pylib import constants |
| 21 from pylib.utils import emulator | 22 from pylib.utils import emulator |
| 22 | 23 |
| 23 def main(argv): | 24 def main(argv): |
| 24 # ANDROID_SDK_ROOT needs to be set to the location of the SDK used to launch | 25 # ANDROID_SDK_ROOT needs to be set to the location of the SDK used to launch |
| 25 # the emulator to find the system images upon launch. | 26 # the emulator to find the system images upon launch. |
| 26 emulator_sdk = constants.ANDROID_SDK_ROOT | 27 emulator_sdk = constants.ANDROID_SDK_ROOT |
| (...skipping 28 matching lines...) Expand all Loading... |
| 55 dest='kill_and_launch', default=True, | 56 dest='kill_and_launch', default=True, |
| 56 help='Kill all emulators at launch') | 57 help='Kill all emulators at launch') |
| 57 run_parser.add_argument('--enable-kvm', action='store_true', | 58 run_parser.add_argument('--enable-kvm', action='store_true', |
| 58 dest='enable_kvm', default=False, | 59 dest='enable_kvm', default=False, |
| 59 help='Enable kvm for faster x86 emulator run') | 60 help='Enable kvm for faster x86 emulator run') |
| 60 | 61 |
| 61 arguments = arg_parser.parse_args(argv[1:]) | 62 arguments = arg_parser.parse_args(argv[1:]) |
| 62 | 63 |
| 63 logging.root.setLevel(logging.INFO) | 64 logging.root.setLevel(logging.INFO) |
| 64 | 65 |
| 66 devil_chromium.Initialize() |
| 67 |
| 65 if arguments.command == 'kill': | 68 if arguments.command == 'kill': |
| 66 logging.info('Killing all existing emulator and existing the program') | 69 logging.info('Killing all existing emulator and existing the program') |
| 67 emulator.KillAllEmulators() | 70 emulator.KillAllEmulators() |
| 68 return | 71 return |
| 69 if arguments.command == 'delete': | 72 if arguments.command == 'delete': |
| 70 emulator.DeleteAllTempAVDs() | 73 emulator.DeleteAllTempAVDs() |
| 71 return | 74 return |
| 72 | 75 |
| 73 # Check if SDK exist in ANDROID_SDK_ROOT | 76 # Check if SDK exist in ANDROID_SDK_ROOT |
| 74 if not install_emulator_deps.CheckSDK(): | 77 if not install_emulator_deps.CheckSDK(): |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 arguments.api_level, | 129 arguments.api_level, |
| 127 enable_kvm=arguments.enable_kvm, | 130 enable_kvm=arguments.enable_kvm, |
| 128 kill_and_launch=arguments.kill_and_launch, | 131 kill_and_launch=arguments.kill_and_launch, |
| 129 sdcard_size=arguments.sdcard_size, | 132 sdcard_size=arguments.sdcard_size, |
| 130 storage_size=arguments.partition_size, | 133 storage_size=arguments.partition_size, |
| 131 wait_for_boot=True | 134 wait_for_boot=True |
| 132 ) | 135 ) |
| 133 | 136 |
| 134 if __name__ == '__main__': | 137 if __name__ == '__main__': |
| 135 sys.exit(main(sys.argv)) | 138 sys.exit(main(sys.argv)) |
| OLD | NEW |