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

Unified Diff: tools/telemetry/telemetry/core/timeline/slice_unittest.py

Issue 19772005: [telemetry] Timeline model cleanups (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « tools/telemetry/telemetry/core/timeline/slice.py ('k') | tools/telemetry/telemetry/core/timeline/thread.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/timeline/slice_unittest.py
diff --git a/tools/telemetry/telemetry/core/timeline/slice_unittest.py b/tools/telemetry/telemetry/core/timeline/slice_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..0e38d4a96a3d26166a93901d477540aacb824141
--- /dev/null
+++ b/tools/telemetry/telemetry/core/timeline/slice_unittest.py
@@ -0,0 +1,26 @@
+# Copyright (c) 2013 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
+
+from telemetry.core.timeline.slice import Slice
+
+class SliceTest(unittest.TestCase):
+ def testChildrenLogic(self):
+ # [ top ]
+ # [ a ] [ b ]
+ # [x]
+ top = Slice(None, 'cat', 'top', 0, duration=10)
+ a = Slice(None, 'cat', 'a', 1, duration=2)
+ x = Slice(None, 'cat', 'x', 1.5, duration=0.25)
+ b = Slice(None, 'cat', 'b', 5, duration=2)
+ top.sub_slices.extend([a, b])
+ a.sub_slices.append(x)
+
+ all_children = list(top.IterEventsInThisContainerRecrusively())
+ self.assertEquals([a, x, b], all_children)
+
+ self.assertEquals(x.self_time, 0.25)
+ self.assertEquals(a.self_time, 1.75) # 2 - 0.25
+ self.assertEquals(top.self_time, 6) # 10 - 2 -2
« no previous file with comments | « tools/telemetry/telemetry/core/timeline/slice.py ('k') | tools/telemetry/telemetry/core/timeline/thread.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698