| Index: build/android/pylib/utils/emulator.py | 
| diff --git a/build/android/emulator.py b/build/android/pylib/utils/emulator.py | 
| similarity index 91% | 
| copy from build/android/emulator.py | 
| copy to build/android/pylib/utils/emulator.py | 
| index 0cbe4c946c5c9a30a86528446acec25f7b506500..70afffb2efc2cbe011bb36b21ff3680c6f5c9f6f 100755 | 
| --- a/build/android/emulator.py | 
| +++ b/build/android/pylib/utils/emulator.py | 
| @@ -19,6 +19,8 @@ import subprocess | 
| import sys | 
| import time | 
|  | 
| +import time_profile | 
| +# TODO(craigdh): Move these pylib dependencies to pylib/utils/. | 
| from pylib import android_commands | 
| from pylib import cmd_helper | 
|  | 
| @@ -99,8 +101,36 @@ def _GetAvailablePort(): | 
| return port | 
|  | 
|  | 
| +def LaunchEmulators(emulator_count, wait_for_boot=True): | 
| +  """Launch multiple emulators and wait for them to boot. | 
| + | 
| +  Args: | 
| +    emulator_count: number of emulators to launch. | 
| + | 
| +  Returns: | 
| +    List of emulators. | 
| +  """ | 
| +  emulators = [] | 
| +  for n in xrange(emulator_count): | 
| +    t = time_profile.TimeProfile('Emulator launch %d' % n) | 
| +    avd_name = None | 
| +    if n > 0: | 
| +      # Creates a temporary AVD for the extra emulators. | 
| +      avd_name = 'run_tests_avd_%d' % n | 
| +    logging.info('Emulator launch %d with avd_name=%s', n, avd_name) | 
| +    emulator = Emulator(avd_name) | 
| +    emulator.Launch(kill_all_emulators=n == 0) | 
| +    t.Stop() | 
| +    emulators.append(emulator) | 
| +  # Wait for all emulators to boot completed. | 
| +  if wait_for_boot: | 
| +    for emulator in emulators: | 
| +      emulator.ConfirmLaunch(True) | 
| +  return emulators | 
| + | 
| + | 
| class Emulator(object): | 
| -  """Provides the methods to lanuch/shutdown the emulator. | 
| +  """Provides the methods to launch/shutdown the emulator. | 
|  | 
| The emulator has the android virtual device named 'avd_armeabi'. | 
|  | 
| @@ -306,10 +336,3 @@ class Emulator(object): | 
| """Install a handler to kill the emulator when we exit unexpectedly.""" | 
| for sig in self._SIGNALS: | 
| signal.signal(sig, self._ShutdownOnSignal) | 
| - | 
| -def main(argv): | 
| -  Emulator(None, True).Launch(True) | 
| - | 
| - | 
| -if __name__ == '__main__': | 
| -  main(sys.argv) | 
|  |