Home | History | Annotate | Download | only in timeline
      1 # Copyright 2014 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 import event
      8 
      9 
     10 class TimelineEventTest(unittest.TestCase):
     11   def testHasThreadTimestamps(self):
     12     # No thread_start and no thread_duration
     13     event_1 = event.TimelineEvent('test', 'foo', 0, 10)
     14     # Has thread_start but no thread_duration
     15     event_2 = event.TimelineEvent('test', 'foo', 0, 10, 2)
     16     # Has thread_duration but no thread_start
     17     event_3 = event.TimelineEvent('test', 'foo', 0, 10, None, 4)
     18     # Has thread_start and thread_duration
     19     event_4 = event.TimelineEvent('test', 'foo', 0, 10, 2, 4)
     20 
     21     self.assertFalse(event_1.has_thread_timestamps)
     22     self.assertFalse(event_2.has_thread_timestamps)
     23     self.assertFalse(event_3.has_thread_timestamps)
     24     self.assertTrue(event_4.has_thread_timestamps)
     25