| 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
|
|
|