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 """ | 5 """ |
6 Provides a variety of device interactions based on adb. | 6 Provides a variety of device interactions based on adb. |
7 | 7 |
8 Eventually, this will be based on adb_wrapper. | 8 Eventually, this will be based on adb_wrapper. |
9 """ | 9 """ |
10 | 10 |
11 import pylib.android_commands | 11 import pylib.android_commands |
12 from pylib.device import adb_wrapper | 12 from pylib.device import adb_wrapper |
13 | 13 |
14 | 14 |
15 def GetAVDs(): | 15 def GetAVDs(): |
16 return pylib.android_commands.GetAVDs() | 16 return pylib.android_commands.GetAVDs() |
17 | 17 |
18 | 18 |
19 class DeviceUtils(object): | 19 class DeviceUtils(object): |
20 | 20 |
21 def __init__(self, device): | 21 def __init__(self, device): |
22 self.old_interface = None | 22 self.old_interface = None |
23 if isinstance(device, str): | 23 if isinstance(device, basestring): |
24 self.old_interface = pylib.android_commands.AndroidCommands(device) | 24 self.old_interface = pylib.android_commands.AndroidCommands(device) |
25 elif isinstance(device, adb_wrapper.AdbWrapper): | 25 elif isinstance(device, adb_wrapper.AdbWrapper): |
26 self.old_interface = pylib.android_commands.AndroidCommands(str(device)) | 26 self.old_interface = pylib.android_commands.AndroidCommands(str(device)) |
27 elif isinstance(device, pylib.android_commands.AndroidCommands): | 27 elif isinstance(device, pylib.android_commands.AndroidCommands): |
28 self.old_interface = device | 28 self.old_interface = device |
29 elif not device: | 29 elif not device: |
30 self.old_interface = pylib.android_commands.AndroidCommands() | 30 self.old_interface = pylib.android_commands.AndroidCommands() |
31 | 31 |
OLD | NEW |