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

Side by Side Diff: systrace/systrace/tracing_agents/battor_trace_agent_unittest.py

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright 2016 The Chromium Authors. All rights reserved. 3 # Copyright 2016 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 from collections import namedtuple 7 from collections import namedtuple
8 import unittest 8 import unittest
9 import logging 9 import logging
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 if self._StopTracing_error: 72 if self._StopTracing_error:
73 raise RuntimeError('Simulated error in StopTracing') 73 raise RuntimeError('Simulated error in StopTracing')
74 self._running = False 74 self._running = False
75 self._tracing = False 75 self._tracing = False
76 self._output = True 76 self._output = True
77 77
78 def CollectTraceData(self): 78 def CollectTraceData(self):
79 assert self._output 79 assert self._output
80 if self._CollectTraceData_error: 80 if self._CollectTraceData_error:
81 raise RuntimeError('Simulated error in CollectTraceData') 81 raise RuntimeError('Simulated error in CollectTraceData')
82 return ['traceout1', 'traceout2'] 82 return 'traceout1\ntraceout2'
83 83
84 class MockBatteryUtils(object): 84 class MockBatteryUtils(object):
85 def __init__(self, _): 85 def __init__(self, _):
86 self._is_charging = True 86 self._is_charging = True
87 87
88 def GetCharging(self): 88 def GetCharging(self):
89 return self._is_charging 89 return self._is_charging
90 90
91 def SetCharging(self, value): 91 def SetCharging(self, value):
92 self._is_charging = value 92 self._is_charging = value
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 StopTracing_error=False, CollectTraceData_error=False) 137 StopTracing_error=False, CollectTraceData_error=False)
138 agent = battor_trace_agent.BattorTraceAgent() 138 agent = battor_trace_agent.BattorTraceAgent()
139 agent.StartAgentTracing(OPTIONS, CATEGORIES) 139 agent.StartAgentTracing(OPTIONS, CATEGORIES)
140 agent.StopAgentTracing() 140 agent.StopAgentTracing()
141 x = agent.GetResults() 141 x = agent.GetResults()
142 self.assertEqual(x.raw_data, 'traceout1\ntraceout2') 142 self.assertEqual(x.raw_data, 'traceout1\ntraceout2')
143 143
144 if __name__ == "__main__": 144 if __name__ == "__main__":
145 logging.getLogger().setLevel(logging.DEBUG) 145 logging.getLogger().setLevel(logging.DEBUG)
146 unittest.main(verbosity=2) 146 unittest.main(verbosity=2)
OLDNEW
« no previous file with comments | « systrace/systrace/tracing_agents/battor_trace_agent.py ('k') | telemetry/examples/benchmarks/tbm_benchmark.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698