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

Unified Diff: build/android/pylib/android_commands.py

Issue 19799003: [android] Instumentation tests determine whether to install test apk based on Md5Sum. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: automatically install package to be tested Created 7 years, 5 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
Index: build/android/pylib/android_commands.py
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
index e282ec86f1f144cbc6970520518c6cc0c9b259d4..5945aedc1fbdfa3875e2fade635499a8016b797e 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -399,6 +399,9 @@ class AndroidCommands(object):
reboots_on_failure=2):
"""Installs specified package and reboots device on timeouts.
+ If package_name is supplied, checks if the package is already installed and
+ doesn't reinstall if the apk md5sums match.
+
Args:
apk_path: Path to .apk file to install.
keep_data: Reinstalls instead of uninstalling first, preserving the
@@ -409,6 +412,14 @@ class AndroidCommands(object):
Returns:
A status string returned by adb install
"""
+ # Check if package is already installed and up to date.
+ if package_name:
+ installed_apk_path = self.GetApplicationPath(package_name)
+ if installed_apk_path and self.CheckMd5Sum(apk_path, installed_apk_path):
+ logging.info('Skipped install: identical %s apk already installed' %
+ package_name)
+ return 'Success: identical %s apk already installed' % package_name
frankf 2013/07/20 02:18:35 Why do we return a string in this method?
craigdh 2013/07/22 19:03:14 Yeah, I thought that was odd too. Doesn't look lik
+ # Install.
reboots_left = reboots_on_failure
while True:
try:
@@ -724,14 +735,12 @@ class AndroidCommands(object):
"""
self.RunShellCommand('input keyevent %d' % keycode)
- def CheckMd5Sum(self, local_path, device_path, ignore_paths=False):
+ def CheckMd5Sum(self, local_path, device_path):
"""Compares the md5sum of a local path against a device path.
Args:
local_path: Path (file or directory) on the host.
device_path: Path on the device.
- ignore_paths: If False, both the md5sum and the relative paths/names of
- files must match. If True, only the md5sum must match.
Returns:
True if the md5sums match.

Powered by Google App Engine
This is Rietveld 408576698