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

Side by Side Diff: systrace/profile_chrome/fake_agent_2.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 trace_data = open(self._PullTrace()).read() 31 trace_data = open(self._PullTrace()).read()
32 return trace_result.TraceResult('fakeDataTwo', trace_data) 32 return trace_result.TraceResult('fakeDataTwo', trace_data)
33 33
34 def _PullTrace(self): 34 def _PullTrace(self):
35 with tempfile.NamedTemporaryFile(delete=False) as f: 35 with tempfile.NamedTemporaryFile(delete=False) as f:
36 self.filename = f.name 36 self.filename = f.name
37 f.write(self.contents) 37 f.write(self.contents)
38 return f.name 38 return f.name
39 39
40 # pylint: disable=no-self-use 40 # pylint: disable=no-self-use
41 def IsConnectionOwner(self):
42 return False
43
44 # pylint: disable=no-self-use
41 def SupportsExplicitClockSync(self): 45 def SupportsExplicitClockSync(self):
42 return False 46 return False
43 47
44 # pylint: disable=unused-argument, no-self-use 48 # pylint: disable=unused-argument, no-self-use
45 def RecordClockSyncMarker(self, sync_id, did_record_sync_marker_callback): 49 def RecordClockSyncMarker(self, sync_id, did_record_sync_marker_callback):
46 print ('Clock sync marker cannot be recorded since explicit clock sync ' 50 print ('Clock sync marker cannot be recorded since explicit clock sync '
47 'is not supported.') 51 'is not supported.')
48 52
49 def __repr__(self): 53 def __repr__(self):
50 return 'faketracetwo' 54 return 'faketracetwo'
51 55
52 56
53 class FakeConfig(tracing_agents.TracingConfig): 57 class FakeConfig(tracing_agents.TracingConfig):
54 def __init__(self): 58 def __init__(self):
55 tracing_agents.TracingConfig.__init__(self) 59 tracing_agents.TracingConfig.__init__(self)
56 60
57 61
58 # pylint: disable=unused-argument 62 # pylint: disable=unused-argument
59 def try_create_agent(config): 63 def try_create_agent(config):
60 return FakeAgent2() 64 return FakeAgent2()
61 65
62 def add_options(parser): 66 def add_options(parser):
63 options = optparse.OptionGroup(parser, 'Fake options.') 67 options = optparse.OptionGroup(parser, 'Fake options.')
64 return options 68 return options
65 69
66 # pylint: disable=unused-argument 70 # pylint: disable=unused-argument
67 def get_config(options): 71 def get_config(options):
68 return FakeConfig() 72 return FakeConfig()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698