OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import unittest |
| 6 |
| 7 from telemetry.timeline_event import TimelineEvent |
| 8 |
| 9 class TimelineEventTest(unittest.TestCase): |
| 10 def testChildrenLogic(self): |
| 11 # [ top ] |
| 12 # [ a ] [ b ] |
| 13 # [x] |
| 14 top = TimelineEvent('top', 0, 10) |
| 15 a = TimelineEvent('a', 1, 2) |
| 16 x = TimelineEvent('x', 1.5, 0.25) |
| 17 b = TimelineEvent('b', 5, 2) |
| 18 top.children.extend([a, b]) |
| 19 a.children.append(x) |
| 20 |
| 21 all_children = top.GetAllChildrenRecursive(include_self=True) |
| 22 self.assertEquals([top, a, x, b], all_children) |
| 23 |
| 24 self.assertEquals(x.self_time_ms, 0.25) |
| 25 self.assertEquals(a.self_time_ms, 1.75) # 2 - 0.25 |
| 26 self.assertEquals(top.self_time_ms, 6) # 10 - 2 -2 |
| 27 |
OLD | NEW |