OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # 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 |
4 # found in the LICENSE file. | 5 # found in the LICENSE file. |
5 | 6 |
6 """Provides an interface to start and stop Android emulator. | 7 """Provides an interface to start and stop Android emulator. |
7 | 8 |
8 Assumes system environment ANDROID_NDK_ROOT has been set. | 9 Assumes system environment ANDROID_NDK_ROOT has been set. |
9 | 10 |
10 Emulator: The class provides the methods to launch/shutdown the emulator with | 11 Emulator: The class provides the methods to launch/shutdown the emulator with |
11 the android virtual device named 'buildbot' . | 12 the android virtual device named 'buildbot' . |
12 """ | 13 """ |
13 | 14 |
14 import logging | 15 import logging |
15 import os | 16 import os |
16 import signal | 17 import signal |
17 import subprocess | 18 import subprocess |
18 import sys | 19 import sys |
19 import time | 20 import time |
20 | 21 |
21 import android_commands | 22 from pylib import android_commands |
| 23 from pylib import cmd_helper |
22 | 24 |
23 # adb_interface.py is under ../../third_party/android_testrunner/ | 25 # adb_interface.py is under ../../third_party/android_testrunner/ |
24 sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', | 26 sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', |
25 '..', 'third_party', 'android_testrunner')) | 27 '..', 'third_party', 'android_testrunner')) |
26 import adb_interface | 28 import adb_interface |
27 import cmd_helper | |
28 import errors | 29 import errors |
29 import run_command | 30 import run_command |
30 | 31 |
31 class EmulatorLaunchException(Exception): | 32 class EmulatorLaunchException(Exception): |
32 """Emulator failed to launch.""" | 33 """Emulator failed to launch.""" |
33 pass | 34 pass |
34 | 35 |
35 def _KillAllEmulators(): | 36 def _KillAllEmulators(): |
36 """Kill all running emulators that look like ones we started. | 37 """Kill all running emulators that look like ones we started. |
37 | 38 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 """Install a handler to kill the emulator when we exit unexpectedly.""" | 246 """Install a handler to kill the emulator when we exit unexpectedly.""" |
246 for sig in self._SIGNALS: | 247 for sig in self._SIGNALS: |
247 signal.signal(sig, self._ShutdownOnSignal) | 248 signal.signal(sig, self._ShutdownOnSignal) |
248 | 249 |
249 def main(argv): | 250 def main(argv): |
250 Emulator(True).Launch(True) | 251 Emulator(True).Launch(True) |
251 | 252 |
252 | 253 |
253 if __name__ == '__main__': | 254 if __name__ == '__main__': |
254 main(sys.argv) | 255 main(sys.argv) |
OLD | NEW |