OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 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 pyauto_tracing |
| 7 import pyauto |
| 8 import tracer |
| 9 |
| 10 |
| 11 class TracingSmokeTest(pyauto.PyUITest): |
| 12 """Test basic functionality of the tracing API.""" |
| 13 def setUp(self): |
| 14 super(TracingSmokeTest, self).setUp() |
| 15 self._tracer_factory = tracer.TracerFactory(self) |
| 16 |
| 17 def testGetData(self): |
| 18 """Check that we can find a CrBrowserMain thread.""" |
| 19 tracer = self._tracer_factory.Produce() |
| 20 tracer.BeginTracing() |
| 21 model = tracer.EndTracing() |
| 22 self.assertEqual(1, len(model.FindAllThreadsNamed('CrBrowserMain'))) |
| 23 |
| 24 def testMultipleTraces(self): |
| 25 """Check that we can run multiple traces on the same tracer.""" |
| 26 tracer = self._tracer_factory.Produce() |
| 27 tracer.BeginTracing() |
| 28 model1 = tracer.EndTracing() |
| 29 tracer.BeginTracing() |
| 30 model2 = tracer.EndTracing() |
| 31 del tracer |
| 32 self.assertEqual(1, len(model1.FindAllThreadsNamed('CrBrowserMain'))) |
| 33 self.assertEqual(1, len(model2.FindAllThreadsNamed('CrBrowserMain'))) |
| 34 |
| 35 def testMultipleTracers(self): |
| 36 """Check that we can run multiple traces with multiple tracers.""" |
| 37 tracer1 = self._tracer_factory.Produce() |
| 38 tracer2 = self._tracer_factory.Produce() |
| 39 del self._tracer_factory |
| 40 # Nested calls to beginTracing is untested and probably won't work. |
| 41 tracer1.BeginTracing() |
| 42 model1 = tracer1.EndTracing() |
| 43 del tracer1 |
| 44 tracer2.BeginTracing() |
| 45 model2 = tracer2.EndTracing() |
| 46 del tracer2 |
| 47 self.assertEqual(1, len(model1.FindAllThreadsNamed('CrBrowserMain'))) |
| 48 del model1 |
| 49 self.assertEqual(1, len(model2.FindAllThreadsNamed('CrBrowserMain'))) |
| 50 del model2 |
| 51 |
| 52 |
| 53 if __name__ == '__main__': |
| 54 pyauto_tracing.Main() |
OLD | NEW |