Chromium Code Reviews| Index: scripts/slave/recipe_modules/blimp/api.py |
| diff --git a/scripts/slave/recipe_modules/blimp/api.py b/scripts/slave/recipe_modules/blimp/api.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2af5dcfad932366fe7cfcd4549666965272fc74b |
| --- /dev/null |
| +++ b/scripts/slave/recipe_modules/blimp/api.py |
| @@ -0,0 +1,56 @@ |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import contextlib |
| + |
| +from recipe_engine import recipe_api |
| +from recipe_engine.config_types import Path |
| + |
| +class BlimpApi(recipe_api.RecipeApi): |
| + def get_config_defaults(self): |
| + return { |
| + 'CHECKOUT_PATH': self.m.path['checkout'], |
| + } |
| + |
| + def _run_engine_forwarder(self, output_linux_dir, **kwargs): |
|
mikecase (-- gone --)
2016/10/17 23:38:35
suuuper nit: I would personally name this just _st
shenghuazhang
2016/10/18 20:39:07
Done.
|
| + args = [ |
| + '-l', output_linux_dir, |
| + 'run', |
| + ] |
| + self.m.python('[Blimp] Starting engine and forwarder', |
| + self.c.client_engine_integration_script, |
| + args, |
| + **kwargs) |
| + |
| + # Installs apk in client and runs blimp. |
|
mikecase (-- gone --)
2016/10/17 23:38:35
nit: Change this comment to a proper docstring lik
shenghuazhang
2016/10/18 20:39:07
Done.
|
| + def load_client(self, output_linux_dir, apk_path, **kwargs): |
| + args = [ |
| + '-l', output_linux_dir, |
| + 'load', |
| + '--apk-path', apk_path, |
| + ] |
| + self.m.python('[Blimp] Installing apk and running blimp', |
| + self.c.client_engine_integration_script, |
| + args, |
| + **kwargs) |
| + |
| + def _stop_engine_forwarder(self, output_linux_dir, **kwargs): |
|
mikecase (-- gone --)
2016/10/17 23:38:35
Nit: Move this function next to _run_engine_forwar
shenghuazhang
2016/10/18 20:39:07
Done.
|
| + args = [ |
| + '-l', output_linux_dir, |
| + 'stop', |
| + ] |
| + self.m.python('[Blimp] Killing engine and forwarder', |
| + self.c.client_engine_integration_script, |
| + args, |
| + **kwargs) |
| + |
| + @contextlib.contextmanager |
| + def engine_forwarder_process(self, output_linux_dir, **kwargs): |
|
mikecase (-- gone --)
2016/10/17 23:38:35
suuuper nit: I would personally name this just eng
shenghuazhang
2016/10/18 20:39:08
Done.
|
| + self._run_engine_forwarder(output_linux_dir, **kwargs) |
|
mikecase (-- gone --)
2016/10/17 23:38:35
Not 100% sure, but Im guessing you want to put thi
shenghuazhang
2016/10/18 20:39:08
Done.
|
| + |
| + try: |
| + yield |
| + finally: |
| + self._stop_engine_forwarder(output_linux_dir) |
| + |