hunspell: Cleanup to fix the header include guards under google/ directory.
[chromium-blink-merge.git] / tools / profile_chrome / systrace_controller_unittest.py
blobe827a082da932863e0b55957d2a6e435ab632d8b
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.
5 import os
7 from profile_chrome import controllers_unittest
8 from profile_chrome import systrace_controller
11 class SystraceControllerTest(controllers_unittest.BaseControllerTest):
12 def testGetCategories(self):
13 categories = \
14 systrace_controller.SystraceController.GetCategories(self.device)
15 self.assertTrue(categories)
16 assert 'gfx' in ' '.join(categories)
18 def testTracing(self):
19 categories = ['gfx', 'input', 'view']
20 ring_buffer = False
21 controller = systrace_controller.SystraceController(self.device,
22 categories,
23 ring_buffer)
25 interval = 1
26 try:
27 controller.StartTracing(interval)
28 finally:
29 controller.StopTracing()
30 result = controller.PullTrace()
32 self.assertFalse(controller.IsTracingOn())
33 try:
34 with open(result) as f:
35 self.assertTrue('CPU#' in f.read())
36 finally:
37 os.remove(result)