| 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 profile_chrome import agents_unittest | 5 from profile_chrome import agents_unittest |
| 6 from profile_chrome import atrace_tracing_agent | 6 from profile_chrome import atrace_tracing_agent |
| 7 from systrace import decorators |
| 7 | 8 |
| 8 | 9 |
| 9 class AtraceAgentTest(agents_unittest.BaseAgentTest): | 10 class AtraceAgentTest(agents_unittest.BaseAgentTest): |
| 11 @decorators.ClientOnlyTest |
| 10 def testGetCategories(self): | 12 def testGetCategories(self): |
| 11 categories = \ | 13 categories = \ |
| 12 atrace_tracing_agent.AtraceAgent.GetCategories(self.device) | 14 atrace_tracing_agent.AtraceAgent.GetCategories(self.device) |
| 13 self.assertTrue(categories) | 15 self.assertTrue(categories) |
| 14 assert 'gfx' in ' '.join(categories) | 16 assert 'gfx' in ' '.join(categories) |
| 15 | 17 |
| 18 # TODO(washingtonp): This test throws an error on the Trybot servers when |
| 19 # running profile_chrome's atrace agent. Once systrace uses profile_chrome's |
| 20 # agent instead, this test may not longer need to be disabled. |
| 21 @decorators.Disabled |
| 16 def testTracing(self): | 22 def testTracing(self): |
| 17 categories = 'gfx,input,view' | 23 categories = 'gfx,input,view' |
| 18 ring_buffer = False | 24 ring_buffer = False |
| 19 agent = atrace_tracing_agent.AtraceAgent(self.device, | 25 agent = atrace_tracing_agent.AtraceAgent(self.device, |
| 20 ring_buffer) | 26 ring_buffer) |
| 21 | 27 |
| 22 try: | 28 try: |
| 23 agent.StartAgentTracing(atrace_tracing_agent.AtraceConfig(categories)) | 29 agent.StartAgentTracing(atrace_tracing_agent.AtraceConfig(categories)) |
| 24 finally: | 30 finally: |
| 25 agent.StopAgentTracing() | 31 agent.StopAgentTracing() |
| 26 result = agent.GetResults() | 32 result = agent.GetResults() |
| 27 | 33 |
| 28 self.assertFalse(agent.IsTracingOn()) | 34 self.assertFalse(agent.IsTracingOn()) |
| 29 self.assertTrue('CPU#' in result.raw_data) | 35 self.assertTrue('CPU#' in result.raw_data) |
| OLD | NEW |