| 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 clovis_constants |
| 11 import test_utils | 11 import test_utils |
| 12 import tracing | 12 import tracing_track |
| 13 | 13 |
| 14 | 14 |
| 15 class ActivityLensTestCase(unittest.TestCase): | 15 class ActivityLensTestCase(unittest.TestCase): |
| 16 @classmethod | 16 @classmethod |
| 17 def _EventsFromRawEvents(cls, raw_events): | 17 def _EventsFromRawEvents(cls, raw_events): |
| 18 tracing_track = tracing.TracingTrack(None, | 18 track = tracing_track.TracingTrack(None, |
| 19 clovis_constants.DEFAULT_CATEGORIES) | 19 clovis_constants.DEFAULT_CATEGORIES) |
| 20 tracing_track.Handle( | 20 track.Handle( |
| 21 'Tracing.dataCollected', {'params': {'value': raw_events}}) | 21 'Tracing.dataCollected', {'params': {'value': raw_events}}) |
| 22 return tracing_track.GetEvents() | 22 return track.GetEvents() |
| 23 | 23 |
| 24 def setUp(self): | 24 def setUp(self): |
| 25 self.tracing_track = tracing.TracingTrack(None, | 25 self.track = tracing_track.TracingTrack(None, |
| 26 clovis_constants.DEFAULT_CATEGORIES) | 26 clovis_constants.DEFAULT_CATEGORIES) |
| 27 | 27 |
| 28 def testGetRendererMainThread(self): | 28 def testGetRendererMainThread(self): |
| 29 first_renderer_tid = 12345 | 29 first_renderer_tid = 12345 |
| 30 second_renderer_tid = 123456 | 30 second_renderer_tid = 123456 |
| 31 raw_events = [ | 31 raw_events = [ |
| 32 {u'args': {u'name': u'CrBrowserMain'}, | 32 {u'args': {u'name': u'CrBrowserMain'}, |
| 33 u'cat': u'__metadata', | 33 u'cat': u'__metadata', |
| 34 u'name': u'thread_name', | 34 u'name': u'thread_name', |
| 35 u'ph': u'M', | 35 u'ph': u'M', |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 [self._ROOT_EVENT], self.tree.DominatingEventsWithNames(('-1'))) | 339 [self._ROOT_EVENT], self.tree.DominatingEventsWithNames(('-1'))) |
| 340 self.assertListEqual( | 340 self.assertListEqual( |
| 341 [self._ROOT_EVENT], self.tree.DominatingEventsWithNames(('-1', '0'))) | 341 [self._ROOT_EVENT], self.tree.DominatingEventsWithNames(('-1', '0'))) |
| 342 self.assertListEqual( | 342 self.assertListEqual( |
| 343 [self._EVENTS[1], self._EVENTS[5]], | 343 [self._EVENTS[1], self._EVENTS[5]], |
| 344 self.tree.DominatingEventsWithNames(('1', '5'))) | 344 self.tree.DominatingEventsWithNames(('1', '5'))) |
| 345 | 345 |
| 346 | 346 |
| 347 if __name__ == '__main__': | 347 if __name__ == '__main__': |
| 348 unittest.main() | 348 unittest.main() |
| OLD | NEW |