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

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

Issue 2295913002: Enable some profile_chrome unit tests on Trybots (Closed) Base URL: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git@master
Patch Set: Add Chris as owner of Systrace bin directory Created 4 years, 3 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
(Empty)
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
3 # found in the LICENSE file.
4
5 import optparse
6 import tempfile
7
8 from systrace import trace_result
9 from systrace import tracing_agents
10
11
12 class FakeAgent2(object):
13 def __init__(self, contents='fake-contents'):
14 self.contents = contents
15 self.stopped = False
16 self.config = None
17 self.filename = None
18
19 # pylint: disable=unused-argument
20 def StartAgentTracing(self, config, timeout=None):
21 self.config = config
22 return True
23
24 # pylint: disable=unused-argument
25 def StopAgentTracing(self, timeout=None):
26 self.stopped = True
27 return True
28
29 # pylint: disable=unused-argument
30 def GetResults(self, timeout=None):
31 trace_data = open(self._PullTrace()).read()
32 return trace_result.TraceResult('fakeDataTwo', trace_data)
33
34 def _PullTrace(self):
35 with tempfile.NamedTemporaryFile(delete=False) as f:
36 self.filename = f.name
37 f.write(self.contents)
38 return f.name
39
40 # pylint: disable=no-self-use
41 def SupportsExplicitClockSync(self):
42 return False
43
44 # pylint: disable=unused-argument, no-self-use
45 def RecordClockSyncMarker(self, sync_id, did_record_sync_marker_callback):
46 print ('Clock sync marker cannot be recorded since explicit clock sync '
47 'is not supported.')
48
49 def __repr__(self):
50 return 'faketracetwo'
51
52
53 class FakeConfig(tracing_agents.TracingConfig):
54 def __init__(self):
55 tracing_agents.TracingConfig.__init__(self)
56
57
58 # pylint: disable=unused-argument
59 def try_create_agent(config):
60 return FakeAgent2()
61
62 def add_options(parser):
63 options = optparse.OptionGroup(parser, 'Fake options.')
64 return options
65
66 # pylint: disable=unused-argument
67 def get_config(options):
68 return FakeConfig()
OLDNEW
« no previous file with comments | « systrace/profile_chrome/fake_agent_1.py ('k') | systrace/profile_chrome/perf_tracing_agent_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698