| 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(washingtonp): This test seems to fail on the version of Android |
| 14 # currently on the Trybot servers (KTU84P), although it works on Android M. |
| 15 # Either upgrade the version of Android on the Trybot servers or determine |
| 16 # if there is a way to run this agent on Android KTU84P. |
| 17 @decorators.Disabled |
| 12 def testGetCategories(self): | 18 def testGetCategories(self): |
| 19 curr_browser = self.GetChromeProcessID() |
| 20 if curr_browser == None: |
| 21 self.StartBrowser() |
| 22 |
| 13 categories = \ | 23 categories = \ |
| 14 chrome_tracing_agent.ChromeTracingAgent.GetCategories( | 24 chrome_tracing_agent.ChromeTracingAgent.GetCategories( |
| 15 self.device, self.package_info) | 25 self.device, self.package_info) |
| 16 | 26 |
| 17 self.assertEquals(len(categories), 2) | 27 self.assertEquals(len(categories), 2) |
| 18 self.assertTrue(categories[0]) | 28 self.assertTrue(categories[0]) |
| 19 self.assertTrue(categories[1]) | 29 self.assertTrue(categories[1]) |
| 20 | 30 |
| 31 # TODO(washingtonp): This test is pretty flaky on the version of Android |
| 32 # currently on the Trybot servers (KTU84P), although it works on Android M. |
| 33 # Either upgrade the version of Android on the Trybot servers or determine |
| 34 # if there is a way to run this agent on Android KTU84P. |
| 35 @decorators.Disabled |
| 21 def testTracing(self): | 36 def testTracing(self): |
| 37 curr_browser = self.GetChromeProcessID() |
| 38 if curr_browser == None: |
| 39 self.StartBrowser() |
| 40 |
| 22 categories = '*' | 41 categories = '*' |
| 23 ring_buffer = False | 42 ring_buffer = False |
| 24 agent = chrome_tracing_agent.ChromeTracingAgent(self.device, | 43 agent = chrome_tracing_agent.ChromeTracingAgent(self.device, |
| 25 self.package_info, | 44 self.package_info, |
| 26 ring_buffer) | 45 ring_buffer) |
| 27 | |
| 28 agent.StartAgentTracing(chrome_tracing_agent.ChromeConfig(categories, None, | 46 agent.StartAgentTracing(chrome_tracing_agent.ChromeConfig(categories, None, |
| 29 None, None, None, None, None, None, ring_buffer, self.device, | 47 None, None, None, None, None, None, ring_buffer, self.device, |
| 30 self.package_info)) | 48 self.package_info)) |
| 31 agent.StopAgentTracing() | 49 agent.StopAgentTracing() |
| 32 result = agent.GetResults() | 50 result = agent.GetResults() |
| 33 json.loads(result.raw_data) | 51 json.loads(result.raw_data) |
| OLD | NEW |