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

Side by Side Diff: systrace/profile_chrome/fake_agent_1.py

Issue 3018533002: Implementing a Monsoon power monitor trace agent, utilizing the UI infrastructure that the BattOr a…
Patch Set: Updating static methods and fixing test fakes. Created 3 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 unified diff | Download patch
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import optparse 5 import optparse
6 import tempfile 6 import tempfile
7 7
8 from systrace import trace_result 8 from systrace import trace_result
9 from systrace import tracing_agents 9 from systrace import tracing_agents
10 10
(...skipping 20 matching lines...) Expand all
31 def GetResults(self, timeout=None): 31 def GetResults(self, timeout=None):
32 trace_data = open(self._PullTrace()).read() 32 trace_data = open(self._PullTrace()).read()
33 return trace_result.TraceResult('fakeData', trace_data) 33 return trace_result.TraceResult('fakeData', trace_data)
34 34
35 def _PullTrace(self): 35 def _PullTrace(self):
36 with tempfile.NamedTemporaryFile(delete=False) as f: 36 with tempfile.NamedTemporaryFile(delete=False) as f:
37 self.filename = f.name 37 self.filename = f.name
38 f.write(self.contents) 38 f.write(self.contents)
39 return f.name 39 return f.name
40 40
41 # pylint: disable=no-self-use 41 # pylint: disable=no-self-use
Chris Craik 2017/09/26 17:57:35 why override in the fake agents?
ddeptford 2017/09/26 18:05:49 The fake agents don't inherit from the common base
42 def IsConnectionOwner(self):
43 return False
44
45 # pylint: disable=no-self-use
42 def SupportsExplicitClockSync(self): 46 def SupportsExplicitClockSync(self):
43 return False 47 return False
44 48
45 # pylint: disable=unused-argument, no-self-use 49 # pylint: disable=unused-argument, no-self-use
46 def RecordClockSyncMarker(self, sync_id, did_record_sync_marker_callback): 50 def RecordClockSyncMarker(self, sync_id, did_record_sync_marker_callback):
47 print ('Clock sync marker cannot be recorded since explicit clock sync ' 51 print ('Clock sync marker cannot be recorded since explicit clock sync '
48 'is not supported.') 52 'is not supported.')
49 53
50 def __repr__(self): 54 def __repr__(self):
51 return 'faketrace' 55 return 'faketrace'
52 56
53 57
54 class FakeConfig(tracing_agents.TracingConfig): 58 class FakeConfig(tracing_agents.TracingConfig):
55 def __init__(self): 59 def __init__(self):
56 tracing_agents.TracingConfig.__init__(self) 60 tracing_agents.TracingConfig.__init__(self)
57 61
58 62
59 # pylint: disable=unused-argument 63 # pylint: disable=unused-argument
60 def try_create_agent(config): 64 def try_create_agent(config):
61 return FakeAgent() 65 return FakeAgent()
62 66
63 def add_options(parser): 67 def add_options(parser):
64 options = optparse.OptionGroup(parser, 'Fake options.') 68 options = optparse.OptionGroup(parser, 'Fake options.')
65 return options 69 return options
66 70
67 # pylint: disable=unused-argument 71 # pylint: disable=unused-argument
68 def get_config(options): 72 def get_config(options):
69 return FakeConfig() 73 return FakeConfig()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698