| OLD | NEW |
| (Empty) | |
| 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 os |
| 6 import json |
| 7 |
| 8 from profile_chrome import chrome_controller |
| 9 from profile_chrome import controllers_unittest |
| 10 |
| 11 |
| 12 class ChromeControllerTest(controllers_unittest.BaseControllerTest): |
| 13 def testGetCategories(self): |
| 14 categories = \ |
| 15 chrome_controller.ChromeTracingController.GetCategories( |
| 16 self.device, self.package_info) |
| 17 |
| 18 self.assertEquals(len(categories), 2) |
| 19 self.assertTrue(categories[0]) |
| 20 self.assertTrue(categories[1]) |
| 21 |
| 22 def testTracing(self): |
| 23 categories = '*' |
| 24 ring_buffer = False |
| 25 controller = chrome_controller.ChromeTracingController(self.device, |
| 26 self.package_info, |
| 27 categories, |
| 28 ring_buffer) |
| 29 |
| 30 interval = 1 |
| 31 try: |
| 32 controller.StartTracing(interval) |
| 33 finally: |
| 34 controller.StopTracing() |
| 35 |
| 36 result = controller.PullTrace() |
| 37 try: |
| 38 with open(result) as f: |
| 39 json.loads(f.read()) |
| 40 finally: |
| 41 os.remove(result) |
| OLD | NEW |