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

Unified Diff: tools/telemetry/telemetry/unittest/system_stub.py

Issue 510943002: [Telemetry] Implement CanLaunchApplication and InstallApplication for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@platform
Patch Set: Fix unittest Created 6 years, 4 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
« no previous file with comments | « tools/telemetry/telemetry/core/platform/profiler/oomkiller_profiler.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/unittest/system_stub.py
diff --git a/tools/telemetry/telemetry/unittest/system_stub.py b/tools/telemetry/telemetry/unittest/system_stub.py
index b7f1a4d07bc039e5d774cee1f08246e300d91134..94d8597fdca344859ce10ce5885e89d4885f684c 100644
--- a/tools/telemetry/telemetry/unittest/system_stub.py
+++ b/tools/telemetry/telemetry/unittest/system_stub.py
@@ -50,18 +50,40 @@ class Override(object):
self._overrides = {}
+class AndroidCommands(object):
+
+ def CanAccessProtectedFileContents(self):
+ return False
+
+
+class AdbDevice(object):
+
+ def __init__(self, shell_command_handlers):
+ self._shell_command_handlers = shell_command_handlers
+
+ def RunShellCommand(self, args):
+ if isinstance(args, basestring):
+ args = shlex.split(args)
+ handler = self._shell_command_handlers[args[0]]
+ return handler(args)
+
+ def FileExists(self, _):
+ return False
+
+ @property
+ def old_interface(self):
+ return AndroidCommands()
+
+
class AdbCommandsModuleStub(object):
+
class AdbCommandsStub(object):
+
def __init__(self, module, device):
self._module = module
self._device = device
self.is_root_enabled = True
-
- def RunShellCommand(self, args):
- if isinstance(args, basestring):
- args = shlex.split(args)
- handler = self._module.shell_command_handlers[args[0]]
- return handler(args)
+ self._adb_device = AdbDevice(module.shell_command_handlers)
def IsRootEnabled(self):
return self.is_root_enabled
@@ -75,9 +97,12 @@ class AdbCommandsModuleStub(object):
def WaitForDevicePm(self):
pass
+ def device(self):
+ return self._adb_device
+
def __init__(self):
- self.attached_devices = []
self.shell_command_handlers = {}
+ self.attached_devices = []
def AdbCommandsStubConstructor(device=None):
return AdbCommandsModuleStub.AdbCommandsStub(self, device)
« no previous file with comments | « tools/telemetry/telemetry/core/platform/profiler/oomkiller_profiler.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698