Chromium Code Reviews| Index: build/android/pylib/utils/emulator.py |
| diff --git a/build/android/pylib/utils/emulator.py b/build/android/pylib/utils/emulator.py |
| index abd0cb64246b20d3816349e028f6b3ceb8865e50..7faf920abef5fc4e91dc26feefac529c0088c6f8 100644 |
| --- a/build/android/pylib/utils/emulator.py |
| +++ b/build/android/pylib/utils/emulator.py |
| @@ -158,7 +158,8 @@ def _GetAvailablePort(): |
| def LaunchTempEmulators(emulator_count, abi, api_level, enable_kvm=False, |
| kill_and_launch=True, sdcard_size=DEFAULT_SDCARD_SIZE, |
| - storage_size=DEFAULT_STORAGE_SIZE, wait_for_boot=True): |
| + storage_size=DEFAULT_STORAGE_SIZE, wait_for_boot=True, |
| + on_bot=False): |
|
jbudorick
2016/01/27 15:58:42
headless instead of on_bot here, too
Yoland Yan(Google)
2016/01/27 17:57:14
Done.
|
| """Create and launch temporary emulators and wait for them to boot. |
| Args: |
| @@ -166,6 +167,7 @@ def LaunchTempEmulators(emulator_count, abi, api_level, enable_kvm=False, |
| abi: the emulator target platform |
| api_level: the api level (e.g., 19 for Android v4.4 - KitKat release) |
| wait_for_boot: whether or not to wait for emulators to boot up |
| + on_bot: running emulator on a bot with no ui |
| Returns: |
| List of emulators. |
| @@ -178,7 +180,8 @@ def LaunchTempEmulators(emulator_count, abi, api_level, enable_kvm=False, |
| logging.info('Emulator launch %d with avd_name=%s and api=%d', |
| n, avd_name, api_level) |
| emulator = Emulator(avd_name, abi, enable_kvm=enable_kvm, |
| - sdcard_size=sdcard_size, storage_size=storage_size) |
| + sdcard_size=sdcard_size, storage_size=storage_size, |
| + on_bot=on_bot) |
| emulator.CreateAVD(api_level) |
| emulator.Launch(kill_all_emulators=(n == 0 and kill_and_launch)) |
| t.Stop() |
| @@ -192,19 +195,21 @@ def LaunchTempEmulators(emulator_count, abi, api_level, enable_kvm=False, |
| def LaunchEmulator(avd_name, abi, kill_and_launch=True, enable_kvm=False, |
| sdcard_size=DEFAULT_SDCARD_SIZE, |
| - storage_size=DEFAULT_STORAGE_SIZE): |
| + storage_size=DEFAULT_STORAGE_SIZE, on_bot=False): |
| """Launch an existing emulator with name avd_name. |
| Args: |
| avd_name: name of existing emulator |
| abi: the emulator target platform |
| + on_bot: running emulator on a bot with no ui |
| Returns: |
| emulator object. |
| """ |
| logging.info('Specified emulator named avd_name=%s launched', avd_name) |
| emulator = Emulator(avd_name, abi, enable_kvm=enable_kvm, |
| - sdcard_size=sdcard_size, storage_size=storage_size) |
| + sdcard_size=sdcard_size, storage_size=storage_size, |
| + on_bot=on_bot) |
| emulator.Launch(kill_all_emulators=kill_and_launch) |
| emulator.ConfirmLaunch(True) |
| return emulator |
| @@ -242,7 +247,7 @@ class Emulator(object): |
| def __init__(self, avd_name, abi, enable_kvm=False, |
| sdcard_size=DEFAULT_SDCARD_SIZE, |
| - storage_size=DEFAULT_STORAGE_SIZE): |
| + storage_size=DEFAULT_STORAGE_SIZE, on_bot=False): |
| """Init an Emulator. |
| Args: |
| @@ -259,6 +264,7 @@ class Emulator(object): |
| self.sdcard_size = sdcard_size |
| self.storage_size = storage_size |
| self.enable_kvm = enable_kvm |
| + self.on_bot = on_bot |
| @staticmethod |
| def _DeviceName(): |
| @@ -375,13 +381,22 @@ class Emulator(object): |
| self.emulator, |
| # Speed up emulator launch by 40%. Really. |
| '-no-boot-anim', |
| + ] |
| + if self.on_bot: |
| + emulator_command.extend([ |
| + '-no-skin', |
| + '-no-audio', |
| + '-no-window' |
| + ]) |
| + emulator_command.extend([ |
| # Use a familiar name and port. |
| '-avd', self.avd_name, |
| '-port', str(port), |
| # Enable GPU by default. |
| '-gpu', 'on', |
| + # all the argument after qemu are sub arguments for qemu |
| '-qemu', '-m', '1024', |
| - ] |
| + ]) |
| if self.abi == 'x86' and self.enable_kvm: |
| emulator_command.extend([ |
| # For x86 emulator --enable-kvm will fail early, avoiding accidental |