| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 os.unlink(full_name) | 189 os.unlink(full_name) |
| 190 | 190 |
| 191 def ConfirmLaunch(self, wait_for_boot=False): | 191 def ConfirmLaunch(self, wait_for_boot=False): |
| 192 """Confirm the emulator launched properly. | 192 """Confirm the emulator launched properly. |
| 193 | 193 |
| 194 Loop on a wait-for-device with a very small timeout. On each | 194 Loop on a wait-for-device with a very small timeout. On each |
| 195 timeout, check the emulator process is still alive. | 195 timeout, check the emulator process is still alive. |
| 196 After confirming a wait-for-device can be successful, make sure | 196 After confirming a wait-for-device can be successful, make sure |
| 197 it returns the right answer. | 197 it returns the right answer. |
| 198 """ | 198 """ |
| 199 a = android_commands.AndroidCommands(self.device, False) | 199 a = android_commands.AndroidCommands(self.device) |
| 200 seconds_waited = 0 | 200 seconds_waited = 0 |
| 201 number_of_waits = 2 # Make sure we can wfd twice | 201 number_of_waits = 2 # Make sure we can wfd twice |
| 202 adb_cmd = "adb -s %s %s" % (self.device, 'wait-for-device') | 202 adb_cmd = "adb -s %s %s" % (self.device, 'wait-for-device') |
| 203 while seconds_waited < self._LAUNCH_TIMEOUT: | 203 while seconds_waited < self._LAUNCH_TIMEOUT: |
| 204 try: | 204 try: |
| 205 run_command.RunCommand(adb_cmd, | 205 run_command.RunCommand(adb_cmd, |
| 206 timeout_time=self._WAITFORDEVICE_TIMEOUT, | 206 timeout_time=self._WAITFORDEVICE_TIMEOUT, |
| 207 retry_count=1) | 207 retry_count=1) |
| 208 number_of_waits -= 1 | 208 number_of_waits -= 1 |
| 209 if not number_of_waits: | 209 if not number_of_waits: |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 """Install a handler to kill the emulator when we exit unexpectedly.""" | 243 """Install a handler to kill the emulator when we exit unexpectedly.""" |
| 244 for sig in self._SIGNALS: | 244 for sig in self._SIGNALS: |
| 245 signal.signal(sig, self._ShutdownOnSignal) | 245 signal.signal(sig, self._ShutdownOnSignal) |
| 246 | 246 |
| 247 def main(argv): | 247 def main(argv): |
| 248 Emulator(True).Launch(True) | 248 Emulator(True).Launch(True) |
| 249 | 249 |
| 250 | 250 |
| 251 if __name__ == '__main__': | 251 if __name__ == '__main__': |
| 252 main(sys.argv) | 252 main(sys.argv) |
| OLD | NEW |