OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Provides an interface to start and stop Android emulator. | 7 """Provides an interface to start and stop Android emulator. |
8 | 8 |
9 Assumes system environment ANDROID_NDK_ROOT has been set. | 9 Assumes system environment ANDROID_NDK_ROOT has been set. |
10 | 10 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 avd_cmd_str = ' '.join(avd_command) | 207 avd_cmd_str = ' '.join(avd_command) |
208 logging.info('Create AVD command: %s', avd_cmd_str) | 208 logging.info('Create AVD command: %s', avd_cmd_str) |
209 avd_process = pexpect.spawn(avd_cmd_str) | 209 avd_process = pexpect.spawn(avd_cmd_str) |
210 | 210 |
211 # Instead of creating a custom profile, we overwrite config files. | 211 # Instead of creating a custom profile, we overwrite config files. |
212 avd_process.expect('Do you wish to create a custom hardware profile') | 212 avd_process.expect('Do you wish to create a custom hardware profile') |
213 avd_process.sendline('no\n') | 213 avd_process.sendline('no\n') |
214 avd_process.expect('Created AVD \'%s\'' % self.avd_name) | 214 avd_process.expect('Created AVD \'%s\'' % self.avd_name) |
215 | 215 |
216 # Setup test device as default Galaxy Nexus AVD | 216 # Setup test device as default Galaxy Nexus AVD |
217 avd_config_dir = os.path.join(constants.CHROME_DIR, 'build', 'android', | 217 avd_config_dir = os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'android', |
218 'avd_configs') | 218 'avd_configs') |
219 avd_config_ini = os.path.join(avd_config_dir, | 219 avd_config_ini = os.path.join(avd_config_dir, |
220 'AVD_for_Galaxy_Nexus_by_Google_%s.avd' % | 220 'AVD_for_Galaxy_Nexus_by_Google_%s.avd' % |
221 self.abi, 'config.ini') | 221 self.abi, 'config.ini') |
222 | 222 |
223 # Replace current configuration with default Galaxy Nexus config. | 223 # Replace current configuration with default Galaxy Nexus config. |
224 avds_dir = os.path.join(os.path.expanduser('~'), '.android', 'avd') | 224 avds_dir = os.path.join(os.path.expanduser('~'), '.android', 'avd') |
225 ini_file = os.path.join(avds_dir, '%s.ini' % self.avd_name) | 225 ini_file = os.path.join(avds_dir, '%s.ini' % self.avd_name) |
226 new_config_ini = os.path.join(avds_dir, '%s.avd' % self.avd_name, | 226 new_config_ini = os.path.join(avds_dir, '%s.avd' % self.avd_name, |
227 'config.ini') | 227 'config.ini') |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 logging.critical('emulator _ShutdownOnSignal') | 359 logging.critical('emulator _ShutdownOnSignal') |
360 for sig in self._SIGNALS: | 360 for sig in self._SIGNALS: |
361 signal.signal(sig, signal.SIG_DFL) | 361 signal.signal(sig, signal.SIG_DFL) |
362 self.Shutdown() | 362 self.Shutdown() |
363 raise KeyboardInterrupt # print a stack | 363 raise KeyboardInterrupt # print a stack |
364 | 364 |
365 def _InstallKillHandler(self): | 365 def _InstallKillHandler(self): |
366 """Install a handler to kill the emulator when we exit unexpectedly.""" | 366 """Install a handler to kill the emulator when we exit unexpectedly.""" |
367 for sig in self._SIGNALS: | 367 for sig in self._SIGNALS: |
368 signal.signal(sig, self._ShutdownOnSignal) | 368 signal.signal(sig, self._ShutdownOnSignal) |
OLD | NEW |