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 from telemetry.timeline import trace_data as trace_data_module |
10 | 11 |
11 | 12 |
12 class FakeAgent2(object): | 13 class FakeAgent2(object): |
13 def __init__(self, contents='fake-contents'): | 14 def __init__(self, contents='fake-contents'): |
14 self.contents = contents | 15 self.contents = contents |
15 self.stopped = False | 16 self.stopped = False |
16 self.config = None | 17 self.config = None |
17 self.filename = None | 18 self.filename = None |
18 | 19 |
19 # pylint: disable=unused-argument | 20 # pylint: disable=unused-argument |
(...skipping 22 matching lines...) Expand all Loading... |
42 return False | 43 return False |
43 | 44 |
44 # pylint: disable=unused-argument, no-self-use | 45 # pylint: disable=unused-argument, no-self-use |
45 def RecordClockSyncMarker(self, sync_id, did_record_sync_marker_callback): | 46 def RecordClockSyncMarker(self, sync_id, did_record_sync_marker_callback): |
46 print ('Clock sync marker cannot be recorded since explicit clock sync ' | 47 print ('Clock sync marker cannot be recorded since explicit clock sync ' |
47 'is not supported.') | 48 'is not supported.') |
48 | 49 |
49 def __repr__(self): | 50 def __repr__(self): |
50 return 'faketracetwo' | 51 return 'faketracetwo' |
51 | 52 |
| 53 def CollectAgentTraceData(self, builder): |
| 54 builder.AddTraceFor(trace_data_module.CPU_TRACE_DATA, 'fake-contents') |
| 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 |