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

Unified Diff: tools/android/mempressure.py

Issue 420273006: [Android] Fix DeviceUtils.__str__ when no serial is provided. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « chrome/test/chromedriver/test/test_environment.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/android/mempressure.py
diff --git a/tools/android/mempressure.py b/tools/android/mempressure.py
index bd606f132235f70f1c4c762dff7d1e4f6a117e75..fa3daba3be6badd9a33ae7df108f6b9c9a4b6df0 100755
--- a/tools/android/mempressure.py
+++ b/tools/android/mempressure.py
@@ -15,8 +15,10 @@ BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__),
'build',
'android')
sys.path.append(BUILD_ANDROID_DIR)
+from pylib import android_commands
from pylib import constants
from pylib import flag_changer
+from pylib.device import device_errors
from pylib.device import device_utils
# Browser Constants
@@ -85,7 +87,12 @@ def main(argv):
package = package_info.package
activity = package_info.activity
- device = device_utils.DeviceUtils(None)
+ devices = android_commands.GetAttachedDevices()
+ if not devices:
+ raise device_errors.NoDevicesError()
+ elif len(devices) > 1:
+ logging.warning('Multiple devices attached. Using %s.' % devices[0])
+ device = device_utils.DeviceUtils(devices[0])
try:
device.EnableRoot()
« no previous file with comments | « chrome/test/chromedriver/test/test_environment.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698