Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Provides a variety of device interactions based on adb. | 5 """Provides a variety of device interactions based on adb. |
| 6 | 6 |
| 7 Eventually, this will be based on adb_wrapper. | 7 Eventually, this will be based on adb_wrapper. |
| 8 """ | 8 """ |
| 9 # pylint: disable=W0613 | 9 # pylint: disable=W0613 |
| 10 | 10 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 @decorators.WithTimeoutAndRetriesFromInstance() | 242 @decorators.WithTimeoutAndRetriesFromInstance() |
| 243 def GetApplicationPath(self, package, timeout=None, retries=None): | 243 def GetApplicationPath(self, package, timeout=None, retries=None): |
| 244 """Get the path of the installed apk on the device for the given package. | 244 """Get the path of the installed apk on the device for the given package. |
| 245 | 245 |
| 246 Args: | 246 Args: |
| 247 package: Name of the package. | 247 package: Name of the package. |
| 248 | 248 |
| 249 Returns: | 249 Returns: |
| 250 Path to the apk on the device if it exists, None otherwise. | 250 Path to the apk on the device if it exists, None otherwise. |
| 251 """ | 251 """ |
| 252 # 'pm path' is liable to incorrectly exit with a nonzero number starting | |
| 253 # in Lollipop. | |
| 254 should_check_return = (self.build_version_sdk < | |
|
klundberg
2014/12/12 00:40:06
So this is starting in Lollipop but might be fixed
| |
| 255 constants.ANDROID_SDK_VERSION_CODES.LOLLIPOP) | |
| 252 output = self.RunShellCommand(['pm', 'path', package], single_line=True, | 256 output = self.RunShellCommand(['pm', 'path', package], single_line=True, |
| 253 check_return=True) | 257 check_return=should_check_return) |
| 254 if not output: | 258 if not output: |
| 255 return None | 259 return None |
| 256 if not output.startswith('package:'): | 260 if not output.startswith('package:'): |
| 257 raise device_errors.CommandFailedError('pm path returned: %r' % output, | 261 raise device_errors.CommandFailedError('pm path returned: %r' % output, |
| 258 str(self)) | 262 str(self)) |
| 259 return output[len('package:'):] | 263 return output[len('package:'):] |
| 260 | 264 |
| 261 @decorators.WithTimeoutAndRetriesFromInstance() | 265 @decorators.WithTimeoutAndRetriesFromInstance() |
| 262 def WaitUntilFullyBooted(self, wifi=False, timeout=None, retries=None): | 266 def WaitUntilFullyBooted(self, wifi=False, timeout=None, retries=None): |
| 263 """Wait for the device to fully boot. | 267 """Wait for the device to fully boot. |
| (...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1190 Returns: | 1194 Returns: |
| 1191 A Parallelizer operating over |devices|. | 1195 A Parallelizer operating over |devices|. |
| 1192 """ | 1196 """ |
| 1193 if not devices: | 1197 if not devices: |
| 1194 devices = adb_wrapper.AdbWrapper.GetDevices() | 1198 devices = adb_wrapper.AdbWrapper.GetDevices() |
| 1195 devices = [d if isinstance(d, cls) else cls(d) for d in devices] | 1199 devices = [d if isinstance(d, cls) else cls(d) for d in devices] |
| 1196 if async: | 1200 if async: |
| 1197 return parallelizer.Parallelizer(devices) | 1201 return parallelizer.Parallelizer(devices) |
| 1198 else: | 1202 else: |
| 1199 return parallelizer.SyncParallelizer(devices) | 1203 return parallelizer.SyncParallelizer(devices) |
| OLD | NEW |