OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 import unittest | |
Nirnimesh
2012/07/31 20:05:57
unused?
| |
7 | |
8 import pyauto_tracing | |
9 import pyauto | |
10 import tracer | |
11 | |
12 | |
13 class TracingSmokeTest(pyauto.PyUITest): | |
14 """Test basic functionality of the tracing API.""" | |
15 def setUp(self): | |
16 super(TracingSmokeTest, self).setUp() | |
17 self._tracer_factory = tracer.TracerFactory(self) | |
18 | |
19 def testGetData(self): | |
20 """Check that we can find a CrBrowserMain thread.""" | |
21 tracer = self._tracer_factory.Produce() | |
22 tracer.BeginTracing() | |
23 model = tracer.EndTracing() | |
24 self.assertEqual(1, len(model.FindAllThreadsNamed('CrBrowserMain'))) | |
25 | |
26 def testMultipleTraces(self): | |
27 """Check that we can run multiple traces on the same tracer.""" | |
28 tracer = self._tracer_factory.Produce() | |
29 tracer.BeginTracing() | |
30 model1 = tracer.EndTracing() | |
31 tracer.BeginTracing() | |
32 model2 = tracer.EndTracing() | |
33 del tracer | |
Nirnimesh
2012/07/31 20:05:57
Why do you have to explicitly destroy it?
Russ Harmon
2012/07/31 20:54:18
In order to implicitly test that a TraceModel will
Russ Harmon
2012/07/31 22:24:55
I just added an explicit test for this validity co
| |
34 self.assertEqual(1, len(model1.FindAllThreadsNamed('CrBrowserMain'))) | |
35 self.assertEqual(1, len(model2.FindAllThreadsNamed('CrBrowserMain'))) | |
36 | |
37 def testMultipleTracers(self): | |
38 """Check that we can run multiple traces with multiple tracers.""" | |
39 tracer1 = self._tracer_factory.Produce() | |
40 tracer2 = self._tracer_factory.Produce() | |
41 del self._tracer_factory | |
42 # I don't know what will happen if you try to nest calls to beginTracing. | |
Nirnimesh
2012/07/31 20:05:57
Do not use first person language in code. ie rephr
| |
43 tracer1.BeginTracing() | |
44 model1 = tracer1.EndTracing() | |
45 del tracer1 | |
46 tracer2.BeginTracing() | |
47 model2 = tracer2.EndTracing() | |
48 del tracer2 | |
49 self.assertEqual(1, len(model1.FindAllThreadsNamed('CrBrowserMain'))) | |
50 del model1 | |
51 self.assertEqual(1, len(model2.FindAllThreadsNamed('CrBrowserMain'))) | |
52 del model2 | |
53 | |
54 | |
55 if __name__ == '__main__': | |
56 pyauto_tracing.Main() | |
OLD | NEW |