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

Unified Diff: build/android/devil/android/device_utils.py

Issue 1398953002: Android gtest runner: Create only a single ApkHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gtest-faster-10
Patch Set: rebase Created 5 years, 2 months 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
« no previous file with comments | « build/android/devil/android/apk_helper.py ('k') | build/android/devil/android/device_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/devil/android/device_utils.py
diff --git a/build/android/devil/android/device_utils.py b/build/android/devil/android/device_utils.py
index 85472e78c291beb3349c7da7624bac2776cba7f0..73ed277c65d40aca9171ed28b7224e69d9292695 100644
--- a/build/android/devil/android/device_utils.py
+++ b/build/android/devil/android/device_utils.py
@@ -527,14 +527,14 @@ class DeviceUtils(object):
@decorators.WithTimeoutAndRetriesFromInstance(
min_default_timeout=INSTALL_DEFAULT_TIMEOUT)
- def Install(self, apk_path, reinstall=False, permissions=None, timeout=None,
+ def Install(self, apk, reinstall=False, permissions=None, timeout=None,
retries=None):
"""Install an APK.
Noop if an identical APK is already installed.
Args:
- apk_path: A string containing the path to the APK to install.
+ apk: An ApkHelper instance or string containing the path to the APK.
permissions: Set of permissions to set. If not set, finds permissions with
apk helper. To set no permissions, pass [].
reinstall: A boolean indicating if we should keep any existing app data.
@@ -546,7 +546,7 @@ class DeviceUtils(object):
CommandTimeoutError if the installation times out.
DeviceUnreachableError on missing device.
"""
- self._InstallInternal(apk_path, None, reinstall=reinstall,
+ self._InstallInternal(apk, None, reinstall=reinstall,
permissions=permissions)
@decorators.WithTimeoutAndRetriesFromInstance(
@@ -559,7 +559,8 @@ class DeviceUtils(object):
Noop if all of the APK splits are already installed.
Args:
- base_apk: A string of the path to the base APK.
+ base_apk: An ApkHelper instance or string containing the path to the base
+ APK.
split_apks: A list of strings of paths of all of the APK splits.
reinstall: A boolean indicating if we should keep any existing app data.
allow_cached_props: Whether to use cached values for device properties.
@@ -583,14 +584,16 @@ class DeviceUtils(object):
if split_apks:
self._CheckSdkLevel(version_codes.LOLLIPOP)
- all_apks = [base_apk]
+ base_apk = apk_helper.ToHelper(base_apk)
+
+ all_apks = [base_apk.path]
if split_apks:
all_apks += split_select.SelectSplits(
- self, base_apk, split_apks, allow_cached_props=allow_cached_props)
+ self, base_apk.path, split_apks, allow_cached_props=allow_cached_props)
if len(all_apks) == 1:
logging.warning('split-select did not select any from %s', split_apks)
- package_name = apk_helper.GetPackageName(base_apk)
+ package_name = base_apk.GetPackageName()
device_apk_paths = self._GetApplicationPathsInternal(package_name)
apks_to_install = None
@@ -625,10 +628,10 @@ class DeviceUtils(object):
self.adb.InstallMultiple(
apks_to_install, partial=partial, reinstall=reinstall)
else:
- self.adb.Install(base_apk, reinstall=reinstall)
+ self.adb.Install(base_apk.path, reinstall=reinstall)
if (permissions is None
and self.build_version_sdk >= version_codes.MARSHMALLOW):
- permissions = apk_helper.ApkHelper(base_apk).GetPermissions()
+ permissions = base_apk.GetPermissions()
self.GrantPermissions(package_name, permissions)
# Upon success, we know the device checksums, but not their paths.
if host_checksums is not None:
« no previous file with comments | « build/android/devil/android/apk_helper.py ('k') | build/android/devil/android/device_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698