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

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

Issue 640813002: Revert of Move remote platforms creation logic from android_browser_finder to platform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/android_profiling_helper_unittest.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 ec61eb9d78021f3873f4e50106e1b55d078a4a45..9c459e53b603a8e2c811275571e5e523de496ea5 100644
--- a/tools/telemetry/telemetry/unittest/system_stub.py
+++ b/tools/telemetry/telemetry/unittest/system_stub.py
@@ -24,7 +24,6 @@
'subprocess': SubprocessModuleStub,
'sys': SysModuleStub,
'thermal_throttle': ThermalThrottleModuleStub,
- 'logging': LoggingStub
}
self.adb_commands = None
self.os = None
@@ -53,40 +52,27 @@
class AndroidCommands(object):
- def __init__(self):
- self.can_access_protected_file_contents = False
-
def CanAccessProtectedFileContents(self):
- return self.can_access_protected_file_contents
+ return False
class AdbDevice(object):
- def __init__(self):
- self.shell_command_handlers = {}
- self.mock_content = []
- self.system_properties = {}
- if self.system_properties.get('ro.product.cpu.abi') == None:
- self.system_properties['ro.product.cpu.abi'] = 'armeabi-v7a'
- self.old_interface = AndroidCommands()
+ 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]]
+ handler = self._shell_command_handlers[args[0]]
return handler(args)
def FileExists(self, _):
return False
- def ReadFile(self, device_path, as_root=False): # pylint: disable=W0613
- return self.mock_content
-
- def GetProp(self, property_name):
- return self.system_properties[property_name]
-
- def SetProp(self, property_name, property_value):
- self.system_properties[property_name] = property_value
+ @property
+ def old_interface(self):
+ return AndroidCommands()
class AdbCommandsModuleStub(object):
@@ -97,7 +83,7 @@
self._module = module
self._device = device
self.is_root_enabled = True
- self._adb_device = module.adb_device
+ self._adb_device = AdbDevice(module.shell_command_handlers)
def IsRootEnabled(self):
return self.is_root_enabled
@@ -115,8 +101,8 @@
return self._adb_device
def __init__(self):
+ self.shell_command_handlers = {}
self.attached_devices = []
- self.adb_device = AdbDevice()
def AdbCommandsStubConstructor(device=None):
return AdbCommandsModuleStub.AdbCommandsStub(self, device)
@@ -165,17 +151,6 @@
def ReadHash(self, hash_path):
return self.local_hash_files[hash_path]
-
-
-class LoggingStub(object):
- def __init__(self):
- self.warnings = []
-
- def info(self, msg, *args):
- pass
-
- def warn(self, msg, *args):
- self.warnings.append(msg % args)
class OpenFunctionStub(object):
« no previous file with comments | « tools/telemetry/telemetry/core/platform/profiler/android_profiling_helper_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698