| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """ A simple device interface for build steps. | 5 """ A simple device interface for build steps. |
| 6 | 6 |
| 7 """ | 7 """ |
| 8 | 8 |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 def GetSerialNumber(self): | 37 def GetSerialNumber(self): |
| 38 return self.id | 38 return self.id |
| 39 | 39 |
| 40 def Install(self, *args, **kwargs): | 40 def Install(self, *args, **kwargs): |
| 41 return self.adb.Install(*args, **kwargs) | 41 return self.adb.Install(*args, **kwargs) |
| 42 | 42 |
| 43 def GetInstallMetadata(self, apk_package): | 43 def GetInstallMetadata(self, apk_package): |
| 44 """Gets the metadata on the device for the apk_package apk.""" | 44 """Gets the metadata on the device for the apk_package apk.""" |
| 45 # Matches lines like: | 45 # Matches lines like: |
| 46 # -rw-r--r-- system system 7376582 2013-04-19 16:34 \ | 46 # -rw-r--r-- system system 7376582 2013-04-19 16:34 \ |
| 47 # org.chromium.chrome.testshell.apk | 47 # org.chromium.chrome.shell.apk |
| 48 # -rw-r--r-- system system 7376582 2013-04-19 16:34 \ | 48 # -rw-r--r-- system system 7376582 2013-04-19 16:34 \ |
| 49 # org.chromium.chrome.testshell-1.apk | 49 # org.chromium.chrome.shell-1.apk |
| 50 apk_matcher = lambda s: re.match('.*%s(-[0-9]*)?.apk$' % apk_package, s) | 50 apk_matcher = lambda s: re.match('.*%s(-[0-9]*)?.apk$' % apk_package, s) |
| 51 matches = filter(apk_matcher, self.install_metadata) | 51 matches = filter(apk_matcher, self.install_metadata) |
| 52 return matches[0] if matches else None | 52 return matches[0] if matches else None |
| 53 | 53 |
| 54 | 54 |
| 55 def GetConfigurationForDevice(id): | 55 def GetConfigurationForDevice(id): |
| 56 adb = android_commands.AndroidCommands(id) | 56 adb = android_commands.AndroidCommands(id) |
| 57 configuration = None | 57 configuration = None |
| 58 has_root = False | 58 has_root = False |
| 59 is_online = adb.IsOnline() | 59 is_online = adb.IsOnline() |
| (...skipping 29 matching lines...) Expand all Loading... |
| 89 assert len(configurations) == 1 | 89 assert len(configurations) == 1 |
| 90 return BuildDevice(configurations[0]) | 90 return BuildDevice(configurations[0]) |
| 91 | 91 |
| 92 | 92 |
| 93 def GetBuildDeviceFromPath(path): | 93 def GetBuildDeviceFromPath(path): |
| 94 configurations = ReadConfigurations(path) | 94 configurations = ReadConfigurations(path) |
| 95 if len(configurations) > 0: | 95 if len(configurations) > 0: |
| 96 return GetBuildDevice(ReadConfigurations(path)) | 96 return GetBuildDevice(ReadConfigurations(path)) |
| 97 return None | 97 return None |
| 98 | 98 |
| OLD | NEW |