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

Unified Diff: build/android/pylib/device/device_utils.py

Issue 839893004: Refactor test scripts for android to improve performance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename a parameter Created 5 years, 11 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/device/device_utils.py
diff --git a/build/android/pylib/device/device_utils.py b/build/android/pylib/device/device_utils.py
index fe9d2c64324ecb378bf43b4c63aa8e1d13a94acc..e249bf60c2577ae41232109e189666bbcf0fa082 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -622,13 +622,16 @@ class DeviceUtils(object):
self.RunShellCommand(['am', 'force-stop', package], check_return=True)
@decorators.WithTimeoutAndRetriesFromInstance()
- def ClearApplicationState(self, package, timeout=None, retries=None):
+ def ClearApplicationState(self, package, timeout=None, retries=None,
+ package_check_needed=True):
jbudorick 2015/01/16 14:21:41 timeout and retries should be the last 2 parameter
Jaekyun Seok (inactive) 2015/01/18 23:01:18 Done.
"""Clear all state for the given package.
Args:
package: A string containing the name of the package to stop.
timeout: timeout in seconds
retries: number of retries
+ package_check_needed: Whether the package existence should be checked or
+ not
Raises:
CommandTimeoutError on timeout.
@@ -636,7 +639,7 @@ class DeviceUtils(object):
"""
# Check that the package exists before clearing it. Necessary because
# calling pm clear on a package that doesn't exist may never return.
- if self.GetApplicationPath(package):
+ if (not package_check_needed) or self.GetApplicationPath(package):
jbudorick 2015/01/16 14:21:41 I'm extremely wary about adding more somewhat supe
Jaekyun Seok (inactive) 2015/01/18 23:01:18 I agree with your concern, but each call to self.G
jbudorick 2015/01/20 14:11:23 That's reasonable; I'm just not sure that the clie
Jaekyun Seok (inactive) 2015/01/20 22:00:23 Caching device status seems dangerous because we c
jbudorick 2015/01/20 22:04:04 What do you mean by "we can't track all the status
Jaekyun Seok (inactive) 2015/01/20 22:11:17 For example, a package could be uninstalled by dev
jbudorick 2015/01/20 22:22:43 I think that case is less risky than the current i
Jaekyun Seok (inactive) 2015/01/20 23:20:35 I see. I will add cache to store application paths
jbudorick 2015/01/20 23:34:24 This could probably be integrated into the existin
perezju 2015/01/21 10:28:52 Yeah, I also dislike the idea of adding this optio
jbudorick 2015/01/21 14:57:00 My concern in this case is that AdbWrapper handles
jbudorick 2015/01/21 15:03:14 If this last part _does_ work on versions starting
self.RunShellCommand(['pm', 'clear', package], check_return=True)
@decorators.WithTimeoutAndRetriesFromInstance()
« no previous file with comments | « no previous file | build/android/pylib/gtest/test_package_apk.py » ('j') | build/android/pylib/gtest/test_package_apk.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698