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 model as model_module 8 from telemetry.timeline import trace_data 9 10 11 class TimelineModelUnittest(unittest.TestCase): 12 def testEmptyImport(self): 13 model_module.TimelineModel(trace_data.TraceData()) 14 15 def testBrowserProcess(self): 16 builder = trace_data.TraceDataBuilder() 17 builder.AddEventsTo(trace_data.CHROME_TRACE_PART, [ 18 {"name": "process_name", "args": {"name": "Browser"}, 19 "pid": 5, "ph": "M"}, 20 {"name": "thread_name", "args": {"name": "CrBrowserMain"}, 21 "pid": 5, "tid": 32578, "ph": "M"} 22 ]) 23 model = model_module.TimelineModel(builder.AsData()) 24 self.assertEquals(5, model.browser_process.pid) 25