| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import contextlib | 5 import contextlib |
| 6 | 6 |
| 7 from recipe_engine import recipe_api | 7 from recipe_engine import recipe_api |
| 8 from recipe_engine.config_types import Path | 8 from recipe_engine.config_types import Path |
| 9 | 9 |
| 10 class EmulatorApi(recipe_api.RecipeApi): | 10 class EmulatorApi(recipe_api.RecipeApi): |
| 11 def get_config_defaults(self): |
| 12 return { |
| 13 'CHECKOUT_PATH': self.m.path['checkout'], |
| 14 } |
| 11 | 15 |
| 12 def install_emulator_deps(self, api_level, **kwargs): | 16 def install_emulator_deps(self, api_level, **kwargs): |
| 13 args = [ | 17 args = [ |
| 14 '--api-level', api_level, | 18 '--api-level', api_level, |
| 15 ] | 19 ] |
| 16 return self.m.python('[emulator] installing emulator deps', | 20 return self.m.python('[emulator] installing emulator deps', |
| 17 self.c.install_emulator_deps_path, args, **kwargs) | 21 self.c.install_emulator_deps_path, args, **kwargs) |
| 18 | 22 |
| 19 def wait_for_emulator(self, num, **kwargs): | 23 def wait_for_emulator(self, num, **kwargs): |
| 20 args = ['wait', '-n', num] | 24 args = ['wait', '-n', num] |
| (...skipping 30 matching lines...) Expand all Loading... |
| 51 | 55 |
| 52 try: | 56 try: |
| 53 yield | 57 yield |
| 54 finally: | 58 finally: |
| 55 exit_args = ['kill'] | 59 exit_args = ['kill'] |
| 56 self.m.python('[emulator] killing all emulators', self.c.avd_script_path, | 60 self.m.python('[emulator] killing all emulators', self.c.avd_script_path, |
| 57 exit_args) | 61 exit_args) |
| 58 delete_avd_args = ['delete'] | 62 delete_avd_args = ['delete'] |
| 59 self.m.python('[emulator] deleting all temp avds after running', | 63 self.m.python('[emulator] deleting all temp avds after running', |
| 60 self.c.avd_script_path, delete_avd_args) | 64 self.c.avd_script_path, delete_avd_args) |
| OLD | NEW |