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