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

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

Issue 15930002: [Android] Force stop test app before launch (start -S) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit addressed Created 7 years, 7 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/pylib/gtest/test_package_apk.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/android_commands.py
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
index e677ba401914d2697facb597e0aa7c851bcd1e92..d5d6e159bd3306cb744c74c82c69f7d5f5a42ded 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -654,6 +654,24 @@ class AndroidCommands(object):
"""
self.RunShellCommand('am force-stop ' + package)
+ def GetApplicationPath(self, package):
+ """Get the installed apk path on the device for the given package.
+
+ Args:
+ package: Name of the package.
+
+ Returns:
+ Path to the apk on the device if it exists, None otherwise.
+ """
+ pm_path_output = self.RunShellCommand('pm path ' + package)
+ # The path output contains anything if and only if the package
+ # exists.
+ if pm_path_output:
+ # pm_path_output is of the form: "package:/path/to/foo.apk"
+ return pm_path_output[0].split(':')[1]
+ else:
+ return None
+
def ClearApplicationState(self, package):
"""Closes and clears all state for the given |package|."""
# Check that the package exists before clearing it. Necessary because
@@ -661,7 +679,6 @@ class AndroidCommands(object):
pm_path_output = self.RunShellCommand('pm path ' + package)
# The path output only contains anything if and only if the package exists.
if pm_path_output:
- self.CloseApplication(package)
self.RunShellCommand('pm clear ' + package)
def SendKeyEvent(self, keycode):
« no previous file with comments | « no previous file | build/android/pylib/gtest/test_package_apk.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698