| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 from chrome_profiler import trace_packager | 5 from adb_profile_chrome import trace_packager |
| 6 | 6 |
| 7 import json | 7 import json |
| 8 import tempfile | 8 import tempfile |
| 9 import unittest | 9 import unittest |
| 10 | 10 |
| 11 | 11 |
| 12 class TracePackagerTest(unittest.TestCase): | 12 class TracePackagerTest(unittest.TestCase): |
| 13 def testJsonTraceMerging(self): | 13 def testJsonTraceMerging(self): |
| 14 t1 = {'traceEvents': [{'ts': 123, 'ph': 'b'}]} | 14 t1 = {'traceEvents': [{'ts': 123, 'ph': 'b'}]} |
| 15 t2 = {'traceEvents': [], 'stackFrames': ['blah']} | 15 t2 = {'traceEvents': [], 'stackFrames': ['blah']} |
| (...skipping 10 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 with tempfile.NamedTemporaryFile() as output: | 27 with tempfile.NamedTemporaryFile() as output: |
| 28 trace_packager.PackageTraces([f1.name, f2.name], | 28 trace_packager.PackageTraces([f1.name, f2.name], |
| 29 output.name, | 29 output.name, |
| 30 compress=False, | 30 compress=False, |
| 31 write_json=True) | 31 write_json=True) |
| 32 with open(output.name) as output: | 32 with open(output.name) as output: |
| 33 output = json.load(output) | 33 output = json.load(output) |
| 34 self.assertEquals(output['traceEvents'], t1['traceEvents']) | 34 self.assertEquals(output['traceEvents'], t1['traceEvents']) |
| 35 self.assertEquals(output['stackFrames'], t2['stackFrames']) | 35 self.assertEquals(output['stackFrames'], t2['stackFrames']) |
| OLD | NEW |