Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: build/android/pylib/utils/emulator.py

Issue 333933003: [Android] Switch to DeviceUtils version of RunShellCommand. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/pylib/screenshot.py ('k') | build/android/pylib/valgrind_tools.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Provides an interface to start and stop Android emulator. 5 """Provides an interface to start and stop Android emulator.
6 6
7 Emulator: The class provides the methods to launch/shutdown the emulator with 7 Emulator: The class provides the methods to launch/shutdown the emulator with
8 the android virtual device named 'avd_armeabi' . 8 the android virtual device named 'avd_armeabi' .
9 """ 9 """
10 10
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 def ConfirmLaunch(self, wait_for_boot=False): 387 def ConfirmLaunch(self, wait_for_boot=False):
388 """Confirm the emulator launched properly. 388 """Confirm the emulator launched properly.
389 389
390 Loop on a wait-for-device with a very small timeout. On each 390 Loop on a wait-for-device with a very small timeout. On each
391 timeout, check the emulator process is still alive. 391 timeout, check the emulator process is still alive.
392 After confirming a wait-for-device can be successful, make sure 392 After confirming a wait-for-device can be successful, make sure
393 it returns the right answer. 393 it returns the right answer.
394 """ 394 """
395 seconds_waited = 0 395 seconds_waited = 0
396 number_of_waits = 2 # Make sure we can wfd twice 396 number_of_waits = 2 # Make sure we can wfd twice
397 # TODO(jbudorick) Un-handroll this in the implementation switch.
397 adb_cmd = "adb -s %s %s" % (self.device_serial, 'wait-for-device') 398 adb_cmd = "adb -s %s %s" % (self.device_serial, 'wait-for-device')
398 while seconds_waited < self._LAUNCH_TIMEOUT: 399 while seconds_waited < self._LAUNCH_TIMEOUT:
399 try: 400 try:
400 run_command.RunCommand(adb_cmd, 401 run_command.RunCommand(adb_cmd,
401 timeout_time=self._WAITFORDEVICE_TIMEOUT, 402 timeout_time=self._WAITFORDEVICE_TIMEOUT,
402 retry_count=1) 403 retry_count=1)
403 number_of_waits -= 1 404 number_of_waits -= 1
404 if not number_of_waits: 405 if not number_of_waits:
405 break 406 break
406 except errors.WaitForResponseTimedOutError: 407 except errors.WaitForResponseTimedOutError:
(...skipping 27 matching lines...) Expand all
434 logging.critical('emulator _ShutdownOnSignal') 435 logging.critical('emulator _ShutdownOnSignal')
435 for sig in self._SIGNALS: 436 for sig in self._SIGNALS:
436 signal.signal(sig, signal.SIG_DFL) 437 signal.signal(sig, signal.SIG_DFL)
437 self.Shutdown() 438 self.Shutdown()
438 raise KeyboardInterrupt # print a stack 439 raise KeyboardInterrupt # print a stack
439 440
440 def _InstallKillHandler(self): 441 def _InstallKillHandler(self):
441 """Install a handler to kill the emulator when we exit unexpectedly.""" 442 """Install a handler to kill the emulator when we exit unexpectedly."""
442 for sig in self._SIGNALS: 443 for sig in self._SIGNALS:
443 signal.signal(sig, self._ShutdownOnSignal) 444 signal.signal(sig, self._ShutdownOnSignal)
OLDNEW
« no previous file with comments | « build/android/pylib/screenshot.py ('k') | build/android/pylib/valgrind_tools.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698