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

Unified Diff: tools/telemetry/telemetry/core/backends/android_app_backend.py

Issue 776883004: Basic android app implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments for modified files. Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/core/backends/android_app_backend.py
diff --git a/tools/telemetry/telemetry/core/backends/android_app_backend.py b/tools/telemetry/telemetry/core/backends/android_app_backend.py
index ddd84688b458fc971aafe2c967044cc2f2f6b5c2..bad80008b0a06d22bdb6ec27b96d921f633538d7 100644
--- a/tools/telemetry/telemetry/core/backends/android_app_backend.py
+++ b/tools/telemetry/telemetry/core/backends/android_app_backend.py
@@ -3,8 +3,29 @@
# found in the LICENSE file.
from telemetry.core.backends import app_backend
+from telemetry.core.platform import android_platform_backend as \
+ android_platform_backend_module
class AndroidAppBackend(app_backend.AppBackend):
- def __init__(self):
- super(AndroidAppBackend, self).__init__()
+ def __init__(self, android_platform_backend, start_intent):
+ super(AndroidAppBackend, self).__init__(app_type=start_intent.package)
+ assert isinstance(android_platform_backend,
+ android_platform_backend_module.AndroidPlatformBackend)
+ self._android_platform_backend = android_platform_backend
+ self._start_intent = start_intent
+
+ @property
+ def _adb(self):
+ return self._android_platform_backend.adb
+
+ def Start(self):
+ """Start an Android app and wait for it to finish launching.
+
+ AppStory derivations can customize the wait-for-ready-state to wait
+ for a more specific event if needed.
+ """
+ self._adb.device().StartActivity(self._start_intent, blocking=True)
+
+ def Close(self):
+ self._android_platform_backend.KillApplication(self._start_intent.package)

Powered by Google App Engine
This is Rietveld 408576698