OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import collections | 5 import collections |
6 import copy | 6 import copy |
7 import unittest | 7 import unittest |
8 | 8 |
9 from activity_lens import (ActivityLens, _EventsTree) | 9 from activity_lens import (ActivityLens, _EventsTree) |
| 10 import clovis_constants |
10 import test_utils | 11 import test_utils |
11 import tracing | 12 import tracing |
12 | 13 |
13 | 14 |
14 class ActivityLensTestCase(unittest.TestCase): | 15 class ActivityLensTestCase(unittest.TestCase): |
15 @classmethod | 16 @classmethod |
16 def _EventsFromRawEvents(cls, raw_events): | 17 def _EventsFromRawEvents(cls, raw_events): |
17 tracing_track = tracing.TracingTrack(None) | 18 tracing_track = tracing.TracingTrack(None, |
| 19 clovis_constants.DEFAULT_CATEGORIES) |
18 tracing_track.Handle( | 20 tracing_track.Handle( |
19 'Tracing.dataCollected', {'params': {'value': raw_events}}) | 21 'Tracing.dataCollected', {'params': {'value': raw_events}}) |
20 return tracing_track.GetEvents() | 22 return tracing_track.GetEvents() |
21 | 23 |
22 def setUp(self): | 24 def setUp(self): |
23 self.tracing_track = tracing.TracingTrack(None) | 25 self.tracing_track = tracing.TracingTrack(None, |
| 26 clovis_constants.DEFAULT_CATEGORIES) |
24 | 27 |
25 def testGetRendererMainThread(self): | 28 def testGetRendererMainThread(self): |
26 first_renderer_tid = 12345 | 29 first_renderer_tid = 12345 |
27 second_renderer_tid = 123456 | 30 second_renderer_tid = 123456 |
28 raw_events = [ | 31 raw_events = [ |
29 {u'args': {u'name': u'CrBrowserMain'}, | 32 {u'args': {u'name': u'CrBrowserMain'}, |
30 u'cat': u'__metadata', | 33 u'cat': u'__metadata', |
31 u'name': u'thread_name', | 34 u'name': u'thread_name', |
32 u'ph': u'M', | 35 u'ph': u'M', |
33 u'pid': 1, | 36 u'pid': 1, |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 [self._ROOT_EVENT], self.tree.DominatingEventsWithNames(('-1'))) | 339 [self._ROOT_EVENT], self.tree.DominatingEventsWithNames(('-1'))) |
337 self.assertListEqual( | 340 self.assertListEqual( |
338 [self._ROOT_EVENT], self.tree.DominatingEventsWithNames(('-1', '0'))) | 341 [self._ROOT_EVENT], self.tree.DominatingEventsWithNames(('-1', '0'))) |
339 self.assertListEqual( | 342 self.assertListEqual( |
340 [self._EVENTS[1], self._EVENTS[5]], | 343 [self._EVENTS[1], self._EVENTS[5]], |
341 self.tree.DominatingEventsWithNames(('1', '5'))) | 344 self.tree.DominatingEventsWithNames(('1', '5'))) |
342 | 345 |
343 | 346 |
344 if __name__ == '__main__': | 347 if __name__ == '__main__': |
345 unittest.main() | 348 unittest.main() |
OLD | NEW |