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

Unified Diff: chrome/test/functional/tracing/tracing_smoke_test.py

Issue 10736055: Smoke test for tracing infrastructure in PyAuto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused unittest import. Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/functional/tracing/tracing_smoke_test.py
diff --git a/chrome/test/functional/tracing/tracing_smoke_test.py b/chrome/test/functional/tracing/tracing_smoke_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..46214214679f2e2a3e1c69f5e90c8e7de8a50c20
--- /dev/null
+++ b/chrome/test/functional/tracing/tracing_smoke_test.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import pyauto_tracing
+import pyauto
+import tracer
+
+
+class TracingSmokeTest(pyauto.PyUITest):
+ """Test basic functionality of the tracing API."""
+ def setUp(self):
+ super(TracingSmokeTest, self).setUp()
+ self._tracer_factory = tracer.TracerFactory(self)
+
+ def testGetData(self):
+ """Check that we can find a CrBrowserMain thread."""
+ tracer = self._tracer_factory.Produce()
+ tracer.BeginTracing()
+ model = tracer.EndTracing()
+ self.assertEqual(1, len(model.FindAllThreadsNamed('CrBrowserMain')))
+
+ def testMultipleTraces(self):
+ """Check that we can run multiple traces on the same tracer."""
+ tracer = self._tracer_factory.Produce()
+ tracer.BeginTracing()
+ model1 = tracer.EndTracing()
+ tracer.BeginTracing()
+ model2 = tracer.EndTracing()
+ self.assertEqual(1, len(model1.FindAllThreadsNamed('CrBrowserMain')))
+ self.assertEqual(1, len(model2.FindAllThreadsNamed('CrBrowserMain')))
+
+ def testMultipleTracers(self):
+ """Check that we can run multiple traces with multiple tracers."""
+ tracer1 = self._tracer_factory.Produce()
+ tracer2 = self._tracer_factory.Produce()
+ # Nested calls to beginTracing is untested and probably won't work.
+ tracer1.BeginTracing()
+ model1 = tracer1.EndTracing()
+ tracer2.BeginTracing()
+ model2 = tracer2.EndTracing()
+ self.assertEqual(1, len(model1.FindAllThreadsNamed('CrBrowserMain')))
+ self.assertEqual(1, len(model2.FindAllThreadsNamed('CrBrowserMain')))
+
+ def testModelValidAfterTracer(self):
+ """Check that a TimelineModel is valid after its Tracer is gone."""
+ tracer = self._tracer_factory.Produce()
+ del self._tracer_factory
+ tracer.BeginTracing()
+ model = tracer.EndTracing()
+ del tracer
+ self.assertEqual(1, len(model.FindAllThreadsNamed('CrBrowserMain')))
+
+
+if __name__ == '__main__':
+ pyauto_tracing.Main()
« chrome/test/functional/tracing/tracer.py ('K') | « chrome/test/functional/tracing/tracer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698