| 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 FakeAgent(object): | 13 class FakeAgent(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.filename = None | 17 self.filename = None |
| 17 self.config = None | 18 self.config = None |
| 18 self.timeout = None | 19 self.timeout = None |
| 19 | 20 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 43 return False | 44 return False |
| 44 | 45 |
| 45 # pylint: disable=unused-argument, no-self-use | 46 # pylint: disable=unused-argument, no-self-use |
| 46 def RecordClockSyncMarker(self, sync_id, did_record_sync_marker_callback): | 47 def RecordClockSyncMarker(self, sync_id, did_record_sync_marker_callback): |
| 47 print ('Clock sync marker cannot be recorded since explicit clock sync ' | 48 print ('Clock sync marker cannot be recorded since explicit clock sync ' |
| 48 'is not supported.') | 49 'is not supported.') |
| 49 | 50 |
| 50 def __repr__(self): | 51 def __repr__(self): |
| 51 return 'faketrace' | 52 return 'faketrace' |
| 52 | 53 |
| 54 def CollectAgentTraceData(self, builder): |
| 55 builder.AddTraceFor(trace_data_module.SURFACE_FLINGER_PART, 'fake-contents') |
| 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() |
| OLD | NEW |