Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: tools/telemetry/telemetry/core/platform/cros_platform_backend.py

Issue 522553002: Move remote platforms creation logic from android_browser_finder to platform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android_browser_finder_unittest Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/core/platform/cros_platform_backend.py
diff --git a/tools/telemetry/telemetry/core/platform/cros_platform_backend.py b/tools/telemetry/telemetry/core/platform/cros_platform_backend.py
index 9e07f04c1424b377723bd0cc9b68c1e447c2df24..26b665a0d270a57267cea3b7f2dc548d107f8e2a 100644
--- a/tools/telemetry/telemetry/core/platform/cros_platform_backend.py
+++ b/tools/telemetry/telemetry/core/platform/cros_platform_backend.py
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from telemetry.core.platform import cros_device
+from telemetry.core.platform import cros_interface
from telemetry.core.platform import linux_based_platform_backend
from telemetry.core.platform import ps_util
from telemetry.core.platform.power_monitor import cros_power_monitor
@@ -10,11 +12,20 @@ from telemetry.core.platform.power_monitor import cros_power_monitor
class CrosPlatformBackend(
linux_based_platform_backend.LinuxBasedPlatformBackend):
- def __init__(self, cri):
- super(CrosPlatformBackend, self).__init__()
- self._cri = cri
+ def __init__(self, device):
+ super(CrosPlatformBackend, self).__init__(device)
+ if device:
+ self._cri = cros_interface.CrOSInterface(
+ device.host_name, device.ssh_identity)
+ self._cri.TryLogin()
+ else:
+ self._cri = cros_interface.CrOSInterface()
self._powermonitor = cros_power_monitor.CrosPowerMonitor(self)
+ @classmethod
+ def SupportsDevice(cls, device):
+ return isinstance(device, cros_device.CrOSDevice)
+
@property
def cri(self):
return self._cri

Powered by Google App Engine
This is Rietveld 408576698