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: systrace/systrace/tracing_agents/battor_trace_agent_unittest.py

Issue 2276263003: Pass in custom options to Systrace agents (Closed) Base URL: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git@master
Patch Set: Rebase Created 4 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
Index: systrace/systrace/tracing_agents/battor_trace_agent_unittest.py
diff --git a/systrace/systrace/tracing_agents/battor_trace_agent_unittest.py b/systrace/systrace/tracing_agents/battor_trace_agent_unittest.py
index 414221771ae1c4298f253437bd50a4e8f8063b49..c77163a6cc66c089bf432a401f5e94d29110f374 100755
--- a/systrace/systrace/tracing_agents/battor_trace_agent_unittest.py
+++ b/systrace/systrace/tracing_agents/battor_trace_agent_unittest.py
@@ -22,6 +22,7 @@ OPTIONS = mock_opts('android', 'Phn2', ['plugable_7port'],
None, False, __file__)
CATEGORIES = None
+
def raise_error(*args, **kwargs):
del args
del kwargs
@@ -29,7 +30,6 @@ def raise_error(*args, **kwargs):
battor_device_mapping.GenerateSerialMapFile = raise_error
-
def setup_battor_test(StartShell_error, StartTracing_error,
StopTracing_error, CollectTraceData_error):
wrapper = MockBattorWrapper(StartShell_error, StartTracing_error,
@@ -40,6 +40,7 @@ def setup_battor_test(StartShell_error, StartTracing_error,
return wrapper
battor_wrapper.BattorWrapper = wrapper_maker
+
class MockBattorWrapper(object):
def __init__(self, StartShell_error=False, StartTracing_error=False,
StopTracing_error=False, CollectTraceData_error=False):
@@ -82,6 +83,7 @@ class MockBattorWrapper(object):
raise RuntimeError('Simulated error in CollectTraceData')
return 'traceout1\ntraceout2'
+
class MockBatteryUtils(object):
def __init__(self, _):
self._is_charging = True
@@ -92,8 +94,10 @@ class MockBatteryUtils(object):
def SetCharging(self, value):
self._is_charging = value
+
battery_utils.BatteryUtils = MockBatteryUtils
+
class BattorAgentTest(unittest.TestCase):
@decorators.HostOnlyTest
@@ -148,6 +152,7 @@ class BattorAgentTest(unittest.TestCase):
x = agent.GetResults()
self.assertEqual(x.raw_data, 'traceout1\ntraceout2')
+
if __name__ == "__main__":
logging.getLogger().setLevel(logging.DEBUG)
unittest.main(verbosity=2)
« no previous file with comments | « systrace/systrace/tracing_agents/battor_trace_agent.py ('k') | systrace/systrace/tracing_agents/ftrace_agent.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698