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

Unified Diff: tools/telemetry/telemetry/timeline_event_unittest.py

Issue 11818024: InspectorTimeline improvements (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 11 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/timeline_event.py ('k') | tools/telemetry/telemetry/timeline_model.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/timeline_event_unittest.py
diff --git a/tools/telemetry/telemetry/timeline_event_unittest.py b/tools/telemetry/telemetry/timeline_event_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..94d59c14960ae1272d660b38a547f703f9983be1
--- /dev/null
+++ b/tools/telemetry/telemetry/timeline_event_unittest.py
@@ -0,0 +1,27 @@
+# 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.timeline_event import TimelineEvent
+
+class TimelineEventTest(unittest.TestCase):
+ def testChildrenLogic(self):
+ # [ top ]
+ # [ a ] [ b ]
+ # [x]
+ top = TimelineEvent('top', 0, 10)
+ a = TimelineEvent('a', 1, 2)
+ x = TimelineEvent('x', 1.5, 0.25)
+ b = TimelineEvent('b', 5, 2)
+ top.children.extend([a, b])
+ a.children.append(x)
+
+ all_children = top.GetAllChildrenRecursive(include_self=True)
+ self.assertEquals([top, a, x, b], all_children)
+
+ self.assertEquals(x.self_time_ms, 0.25)
+ self.assertEquals(a.self_time_ms, 1.75) # 2 - 0.25
+ self.assertEquals(top.self_time_ms, 6) # 10 - 2 -2
+
« no previous file with comments | « tools/telemetry/telemetry/timeline_event.py ('k') | tools/telemetry/telemetry/timeline_model.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698