diff options
author | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-01 18:55:26 +0000 |
---|---|---|
committer | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-01 18:55:26 +0000 |
commit | 893e8683a561f7b561a70a444ae538ff14fc6c76 (patch) | |
tree | 777f5becb20a997e5aa6ea9c7b12cfc33c34c136 /build/android/adb_install_apk.py | |
parent | b3ac1dfffb8afcce8f105ad42a17c1a36f012c72 (diff) | |
download | chromium_src-893e8683a561f7b561a70a444ae538ff14fc6c76.zip chromium_src-893e8683a561f7b561a70a444ae538ff14fc6c76.tar.gz chromium_src-893e8683a561f7b561a70a444ae538ff14fc6c76.tar.bz2 |
Android: makes "apk_package" optional in adb_install_apk.py
We can derive the package name from the mandatory apk.
BUG=
TEST=adb_install_apk.py --apk ContentShell.apk
Review URL: https://chromiumcodereview.appspot.com/11365004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165450 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/android/adb_install_apk.py')
-rwxr-xr-x | build/android/adb_install_apk.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/build/android/adb_install_apk.py b/build/android/adb_install_apk.py index 355b963..db2c62c 100755 --- a/build/android/adb_install_apk.py +++ b/build/android/adb_install_apk.py @@ -10,27 +10,24 @@ import os import sys from pylib import android_commands -from pylib import test_options_parser +from pylib import apk_info from pylib import constants +from pylib import test_options_parser -def InstallApk(args): - options, device = args - apk_path = os.path.join(os.environ['CHROME_SRC'], - 'out', options.build_type, - 'apks', options.apk) +def _InstallApk(args): + apk_path, apk_package, device = args result = android_commands.AndroidCommands(device=device).ManagedInstall( - apk_path, False, options.apk_package) + apk_path, False, apk_package) print '----- Installed on %s -----' % device print result def main(argv): parser = optparse.OptionParser() - test_options_parser.AddBuildTypeOption(parser) test_options_parser.AddInstallAPKOption(parser) options, args = parser.parse_args(argv) - + test_options_parser.ValidateInstallAPKOption(parser, options) if len(args) > 1: raise Exception('Error: Unknown argument:', args[1:]) @@ -38,9 +35,14 @@ def main(argv): if not devices: raise Exception('Error: no connected devices') + if not options.apk_package: + options.apk_package = apk_info.GetPackageNameForApk(options.apk) + pool = multiprocessing.Pool(len(devices)) - # Send a tuple (options, device) per instance of DeploySingleDevice. - pool.map(InstallApk, zip([options] * len(devices), devices)) + # Send a tuple (apk_path, apk_package, device) per device. + pool.map(_InstallApk, zip([options.apk] * len(devices), + [options.apk_package] * len(devices), + devices)) if __name__ == '__main__': |