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 import logging | 5 import logging |
6 | 6 |
7 from telemetry import decorators | 7 from telemetry import decorators |
8 from telemetry.core import cros_interface | 8 from telemetry.core import cros_interface |
9 from telemetry.core import platform | 9 from telemetry.core import platform |
10 from telemetry.core import util | 10 from telemetry.core import util |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 def forwarder_factory(self): | 48 def forwarder_factory(self): |
49 if not self._forwarder_factory: | 49 if not self._forwarder_factory: |
50 self._forwarder_factory = cros_forwarder.CrOsForwarderFactory(self._cri) | 50 self._forwarder_factory = cros_forwarder.CrOsForwarderFactory(self._cri) |
51 return self._forwarder_factory | 51 return self._forwarder_factory |
52 | 52 |
53 def GetRemotePort(self, port): | 53 def GetRemotePort(self, port): |
54 if self._cri.local: | 54 if self._cri.local: |
55 return port | 55 return port |
56 return self._cri.GetRemotePort() | 56 return self._cri.GetRemotePort() |
57 | 57 |
| 58 def CreatePortForwarder(self, port_pair, use_remote_port_forwarding=False): |
| 59 return self.forwarder_factory.Create(port_pair, use_remote_port_forwarding) |
| 60 |
| 61 def IsDeviceRemote(self): |
| 62 # Check if CrOS device is remote. |
| 63 return self._cri and not self._cri.local |
| 64 |
58 def IsThermallyThrottled(self): | 65 def IsThermallyThrottled(self): |
59 raise NotImplementedError() | 66 raise NotImplementedError() |
60 | 67 |
61 def HasBeenThermallyThrottled(self): | 68 def HasBeenThermallyThrottled(self): |
62 raise NotImplementedError() | 69 raise NotImplementedError() |
63 | 70 |
64 def RunCommand(self, args): | 71 def RunCommand(self, args): |
65 if not isinstance(args, list): | 72 if not isinstance(args, list): |
66 args = [args] | 73 args = [args] |
67 stdout, stderr = self._cri.RunCmdOnDevice(args) | 74 stdout, stderr = self._cri.RunCmdOnDevice(args) |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 logging.warning( | 168 logging.warning( |
162 'PathExists: params timeout and retries are not support on CrOS.') | 169 'PathExists: params timeout and retries are not support on CrOS.') |
163 return self._cri.FileExistsOnDevice(path) | 170 return self._cri.FileExistsOnDevice(path) |
164 | 171 |
165 def CanTakeScreenshot(self): | 172 def CanTakeScreenshot(self): |
166 # crbug.com/609001: screenshots don't work on VMs. | 173 # crbug.com/609001: screenshots don't work on VMs. |
167 return not self.cri.IsRunningOnVM() | 174 return not self.cri.IsRunningOnVM() |
168 | 175 |
169 def TakeScreenshot(self, file_path): | 176 def TakeScreenshot(self, file_path): |
170 return self._cri.TakeScreenshot(file_path) | 177 return self._cri.TakeScreenshot(file_path) |
OLD | NEW |