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

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: Add more docstrings. 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..42fd573d1f5dd756698e8d604af48851cf94ef4a
--- /dev/null
+++ b/chrome/test/functional/tracing/tracing_smoke_test.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+# Copyright (c) 2011 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 unittest
Nirnimesh 2012/07/31 20:05:57 unused?
+
+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()
+ 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
+ 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()
+ del self._tracer_factory
+ # 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
+ tracer1.BeginTracing()
+ model1 = tracer1.EndTracing()
+ del tracer1
+ tracer2.BeginTracing()
+ model2 = tracer2.EndTracing()
+ del tracer2
+ self.assertEqual(1, len(model1.FindAllThreadsNamed('CrBrowserMain')))
+ del model1
+ self.assertEqual(1, len(model2.FindAllThreadsNamed('CrBrowserMain')))
+ del model2
+
+
+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