| 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 chrome_tracing_agent | 7 from profile_chrome import chrome_tracing_agent |
| 8 from profile_chrome import agents_unittest | 8 from profile_chrome import agents_unittest |
| 9 from systrace import decorators |
| 9 | 10 |
| 10 | 11 |
| 11 class ChromeAgentTest(agents_unittest.BaseAgentTest): | 12 class ChromeAgentTest(agents_unittest.BaseAgentTest): |
| 13 # TODO: This test seems to fail on the version of Android currently on the |
| 14 # Trybot servers (KTU84P), although it works on Android M. Either upgrade the |
| 15 # version of Android on the Trybot servers or determine if there is a way to |
| 16 # run this agent on Android KTU84P. |
| 17 @decorators.Disabled |
| 12 def testGetCategories(self): | 18 def testGetCategories(self): |
| 13 categories = \ | 19 categories = \ |
| 14 chrome_tracing_agent.ChromeTracingAgent.GetCategories( | 20 chrome_tracing_agent.ChromeTracingAgent.GetCategories( |
| 15 self.device, self.package_info) | 21 self.device, self.package_info) |
| 16 | 22 |
| 17 self.assertEquals(len(categories), 2) | 23 self.assertEquals(len(categories), 2) |
| 18 self.assertTrue(categories[0]) | 24 self.assertTrue(categories[0]) |
| 19 self.assertTrue(categories[1]) | 25 self.assertTrue(categories[1]) |
| 20 | 26 |
| 27 @decorators.ClientOnlyTest |
| 21 def testTracing(self): | 28 def testTracing(self): |
| 22 categories = '*' | 29 categories = '*' |
| 23 ring_buffer = False | 30 ring_buffer = False |
| 24 agent = chrome_tracing_agent.ChromeTracingAgent(self.device, | 31 agent = chrome_tracing_agent.ChromeTracingAgent(self.device, |
| 25 self.package_info, | 32 self.package_info, |
| 26 ring_buffer) | 33 ring_buffer) |
| 27 | 34 |
| 28 agent.StartAgentTracing(chrome_tracing_agent.ChromeConfig(categories, None, | 35 agent.StartAgentTracing(chrome_tracing_agent.ChromeConfig(categories, None, |
| 29 None, None, None, | 36 None, None, None, |
| 30 None, None, | 37 None, None, |
| 31 None)) | 38 None)) |
| 32 agent.StopAgentTracing() | 39 agent.StopAgentTracing() |
| 33 result = agent.GetResults() | 40 result = agent.GetResults() |
| 34 json.loads(result.raw_data) | 41 json.loads(result.raw_data) |
| OLD | NEW |