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

Unified Diff: build/android/adb_install_apk.py

Issue 18514008: Relands test_runner.py, updates buildbot scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moves test_suite option back into gtest only 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
« no previous file with comments | « no previous file | build/android/buildbot/bb_device_steps.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/adb_install_apk.py
diff --git a/build/android/adb_install_apk.py b/build/android/adb_install_apk.py
index ad694571e6b2fcfb43e46915e2424f842b77a129..8ff623079913b4087771a9ffc676a27423a1e9f9 100755
--- a/build/android/adb_install_apk.py
+++ b/build/android/adb_install_apk.py
@@ -4,6 +4,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+"""Utility script to install APKs from the command line quickly."""
+
import multiprocessing
import optparse
import os
@@ -15,6 +17,32 @@ from pylib.utils import apk_helper
from pylib.utils import test_options_parser
+def AddInstallAPKOption(option_parser):
+ """Adds apk option used to install the APK to the OptionParser."""
+ test_options_parser.AddBuildTypeOption(option_parser)
+ option_parser.add_option('--apk',
+ help=('The name of the apk containing the '
+ ' application (with the .apk extension).'))
+ option_parser.add_option('--apk_package',
+ help=('The package name used by the apk containing '
+ 'the application.'))
+ option_parser.add_option('--keep_data',
+ action='store_true',
+ default=False,
+ help=('Keep the package data when installing '
+ 'the application.'))
+
+
+def ValidateInstallAPKOption(option_parser, options):
+ """Validates the apk option and potentially qualifies the path."""
+ if not options.apk:
+ option_parser.error('--apk is mandatory.')
+ if not os.path.exists(options.apk):
+ options.apk = os.path.join(constants.DIR_SOURCE_ROOT,
+ 'out', options.build_type,
+ 'apks', options.apk)
+
+
def _InstallApk(args):
apk_path, apk_package, keep_data, device = args
result = android_commands.AndroidCommands(device=device).ManagedInstall(
@@ -25,9 +53,9 @@ def _InstallApk(args):
def main(argv):
parser = optparse.OptionParser()
- test_options_parser.AddInstallAPKOption(parser)
+ AddInstallAPKOption(parser)
options, args = parser.parse_args(argv)
- test_options_parser.ValidateInstallAPKOption(parser, options)
+ ValidateInstallAPKOption(parser, options)
if len(args) > 1:
raise Exception('Error: Unknown argument:', args[1:])
« no previous file with comments | « no previous file | build/android/buildbot/bb_device_steps.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698