| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Brings in Chrome Android's android_commands module, which itself is a | 4 """Brings in Chrome Android's android_commands module, which itself is a |
| 5 thin(ish) wrapper around adb.""" | 5 thin(ish) wrapper around adb.""" |
| 6 import os | 6 import os |
| 7 import sys | 7 import sys |
| 8 | 8 |
| 9 # This is currently a thin wrapper around Chrome Android's | 9 # This is currently a thin wrapper around Chrome Android's |
| 10 # build scripts, located in chrome/build/android. This file exists mainly to | 10 # build scripts, located in chrome/build/android. This file exists mainly to |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 def GetOutDirectory(): | 48 def GetOutDirectory(): |
| 49 return cmd_helper.OutDirectory.get() | 49 return cmd_helper.OutDirectory.get() |
| 50 | 50 |
| 51 | 51 |
| 52 class AdbCommands(object): | 52 class AdbCommands(object): |
| 53 """A thin wrapper around ADB""" | 53 """A thin wrapper around ADB""" |
| 54 | 54 |
| 55 def __init__(self, device): | 55 def __init__(self, device): |
| 56 self._adb = android_commands.AndroidCommands(device) | 56 self._adb = android_commands.AndroidCommands(device) |
| 57 self._device = device |
| 58 |
| 59 def device(self): |
| 60 return self._device |
| 57 | 61 |
| 58 def Adb(self): | 62 def Adb(self): |
| 59 return self._adb | 63 return self._adb |
| 60 | 64 |
| 61 def Forward(self, local, remote): | 65 def Forward(self, local, remote): |
| 62 ret = self._adb.Adb().SendCommand('forward %s %s' % (local, remote)) | 66 ret = self._adb.Adb().SendCommand('forward %s %s' % (local, remote)) |
| 63 assert ret == '' | 67 assert ret == '' |
| 64 | 68 |
| 65 def RunShellCommand(self, command, timeout_time=20, log_result=False): | 69 def RunShellCommand(self, command, timeout_time=20, log_result=False): |
| 66 """Send a command to the adb shell and return the result. | 70 """Send a command to the adb shell and return the result. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 184 |
| 181 @property | 185 @property |
| 182 def url(self): | 186 def url(self): |
| 183 assert self._forwarder | 187 assert self._forwarder |
| 184 return 'http://localhost:%i' % self._host_port | 188 return 'http://localhost:%i' % self._host_port |
| 185 | 189 |
| 186 def Close(self): | 190 def Close(self): |
| 187 if self._forwarder: | 191 if self._forwarder: |
| 188 self._forwarder.Close() | 192 self._forwarder.Close() |
| 189 self._forwarder = None | 193 self._forwarder = None |
| OLD | NEW |