summaryrefslogtreecommitdiff
path: root/systrace/catapult/systrace/profile_chrome/atrace_tracing_agent_unittest.py
blob: 24f3c7e3d746050f438d1bdac355b7bcc914ba57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

from profile_chrome import agents_unittest
from profile_chrome import atrace_tracing_agent
from systrace import decorators


class AtraceAgentTest(agents_unittest.BaseAgentTest):
  @decorators.ClientOnlyTest
  def testGetCategories(self):
    categories = \
        atrace_tracing_agent.AtraceAgent.GetCategories(self.device)
    self.assertTrue(categories)
    assert 'gfx' in ' '.join(categories)

  # TODO(washingtonp): This test throws an error on the Trybot servers when
  # running profile_chrome's atrace agent. Once systrace uses profile_chrome's
  # agent instead, this test may not longer need to be disabled.
  @decorators.Disabled
  def testTracing(self):
    categories = 'gfx,input,view'
    ring_buffer = False
    agent = atrace_tracing_agent.AtraceAgent(self.device,
                                             ring_buffer)

    try:
      agent.StartAgentTracing(atrace_tracing_agent.AtraceConfig(categories,
          self.device, ring_buffer))
    finally:
      agent.StopAgentTracing()
    result = agent.GetResults()

    self.assertFalse(agent.IsTracingOn())
    self.assertTrue('CPU#' in result.raw_data)