OLD | NEW |
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 Loading... |
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() |
OLD | NEW |