Chromium Code Reviews| 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 import json | 5 import json |
| 6 | 6 |
| 7 from profile_chrome import agents_unittest | 7 from profile_chrome import agents_unittest |
| 8 from profile_chrome import perf_tracing_agent | 8 from profile_chrome import perf_tracing_agent |
| 9 from profile_chrome import ui | 9 from profile_chrome import ui |
| 10 from systrace import decorators | |
| 10 | 11 |
| 11 | 12 |
| 12 class PerfProfilerAgentTest(agents_unittest.BaseAgentTest): | 13 class PerfProfilerAgentTest(agents_unittest.BaseAgentTest): |
| 14 @decorators.ClientOnlyTest | |
| 13 def testGetCategories(self): | 15 def testGetCategories(self): |
| 14 if not perf_tracing_agent.PerfProfilerAgent.IsSupported(): | 16 if not perf_tracing_agent.PerfProfilerAgent.IsSupported(): |
| 15 return | 17 return |
| 16 categories = \ | 18 categories = \ |
| 17 perf_tracing_agent.PerfProfilerAgent.GetCategories(self.device) | 19 perf_tracing_agent.PerfProfilerAgent.GetCategories(self.device) |
| 18 assert 'cycles' in ' '.join(categories) | 20 assert 'cycles' in ' '.join(categories) |
| 19 | 21 |
| 22 # TODO: Try enabling this test for the SimpleperfProfilerAgent, which will | |
|
Sami
2016/09/09 10:28:25
nit: User name missing.
washingtonp
2016/09/09 18:07:29
Done.
| |
| 23 # be added later. | |
| 24 @decorators.Disabled | |
| 20 def testTracing(self): | 25 def testTracing(self): |
| 21 if not perf_tracing_agent.PerfProfilerAgent.IsSupported(): | 26 if not perf_tracing_agent.PerfProfilerAgent.IsSupported(): |
| 22 return | 27 return |
| 23 ui.EnableTestMode() | 28 ui.EnableTestMode() |
| 24 categories = 'cycles' | 29 categories = 'cycles' |
| 25 agent = perf_tracing_agent.PerfProfilerAgent(self.device) | 30 agent = perf_tracing_agent.PerfProfilerAgent(self.device) |
| 26 | 31 |
| 27 try: | 32 try: |
| 28 agent.StartAgentTracing(perf_tracing_agent.PerfConfig(categories)) | 33 agent.StartAgentTracing(perf_tracing_agent.PerfConfig(categories)) |
| 29 finally: | 34 finally: |
| 30 agent.StopAgentTracing() | 35 agent.StopAgentTracing() |
| 31 | 36 |
| 32 result = agent.GetResults() | 37 result = agent.GetResults() |
| 33 json.loads(result.raw_data) | 38 json.loads(result.raw_data) |
| OLD | NEW |