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 |
11 from telemetry.internal import forwarders | |
12 from telemetry.internal.forwarders import cros_forwarder | 11 from telemetry.internal.forwarders import cros_forwarder |
13 from telemetry.internal.platform import cros_device | 12 from telemetry.internal.platform import cros_device |
14 from telemetry.internal.platform import linux_based_platform_backend | 13 from telemetry.internal.platform import linux_based_platform_backend |
15 from telemetry.internal.platform.power_monitor import cros_power_monitor | 14 from telemetry.internal.platform.power_monitor import cros_power_monitor |
16 from telemetry.internal.util import ps_util | 15 from telemetry.internal.util import ps_util |
17 | 16 |
18 | 17 |
19 class CrosPlatformBackend( | 18 class CrosPlatformBackend( |
20 linux_based_platform_backend.LinuxBasedPlatformBackend): | 19 linux_based_platform_backend.LinuxBasedPlatformBackend): |
21 def __init__(self, device=None): | 20 def __init__(self, device=None): |
(...skipping 27 matching lines...) Expand all Loading... |
49 def forwarder_factory(self): | 48 def forwarder_factory(self): |
50 if not self._forwarder_factory: | 49 if not self._forwarder_factory: |
51 self._forwarder_factory = cros_forwarder.CrOsForwarderFactory(self._cri) | 50 self._forwarder_factory = cros_forwarder.CrOsForwarderFactory(self._cri) |
52 return self._forwarder_factory | 51 return self._forwarder_factory |
53 | 52 |
54 def GetRemotePort(self, port): | 53 def GetRemotePort(self, port): |
55 if self._cri.local: | 54 if self._cri.local: |
56 return port | 55 return port |
57 return self._cri.GetRemotePort() | 56 return self._cri.GetRemotePort() |
58 | 57 |
59 def GetWprPortPairs(self): | |
60 """Return suitable port pairs to be used for web page replay.""" | |
61 default_local_ports = super(CrosPlatformBackend, self).GetWprPortPairs( | |
62 ).local_ports | |
63 return forwarders.PortPairs.Zip( | |
64 default_local_ports, | |
65 forwarders.PortSet( | |
66 http=self.GetRemotePort(default_local_ports.http), | |
67 https=self.GetRemotePort(default_local_ports.https), | |
68 dns=None)) | |
69 | |
70 def IsThermallyThrottled(self): | 58 def IsThermallyThrottled(self): |
71 raise NotImplementedError() | 59 raise NotImplementedError() |
72 | 60 |
73 def HasBeenThermallyThrottled(self): | 61 def HasBeenThermallyThrottled(self): |
74 raise NotImplementedError() | 62 raise NotImplementedError() |
75 | 63 |
76 def RunCommand(self, args): | 64 def RunCommand(self, args): |
77 if not isinstance(args, list): | 65 if not isinstance(args, list): |
78 args = [args] | 66 args = [args] |
79 stdout, stderr = self._cri.RunCmdOnDevice(args) | 67 stdout, stderr = self._cri.RunCmdOnDevice(args) |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 logging.warning( | 158 logging.warning( |
171 'PathExists: params timeout and retries are not support on CrOS.') | 159 'PathExists: params timeout and retries are not support on CrOS.') |
172 return self._cri.FileExistsOnDevice(path) | 160 return self._cri.FileExistsOnDevice(path) |
173 | 161 |
174 def CanTakeScreenshot(self): | 162 def CanTakeScreenshot(self): |
175 # crbug.com/609001: screenshots don't work on VMs. | 163 # crbug.com/609001: screenshots don't work on VMs. |
176 return not self.cri.IsRunningOnVM() | 164 return not self.cri.IsRunningOnVM() |
177 | 165 |
178 def TakeScreenshot(self, file_path): | 166 def TakeScreenshot(self, file_path): |
179 return self._cri.TakeScreenshot(file_path) | 167 return self._cri.TakeScreenshot(file_path) |
OLD | NEW |