summaryrefslogtreecommitdiff
path: root/systrace/catapult/systrace/profile_chrome/chrome_tracing_agent_unittest.py
blob: dc3875957cfe95c866e060685ad5cd4480a22327 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# 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.

import json

from profile_chrome import chrome_tracing_agent
from profile_chrome import agents_unittest
from systrace import decorators


class ChromeAgentTest(agents_unittest.BaseAgentTest):
  # TODO(washingtonp): This test seems to fail on the version of Android
  # currently on the Trybot servers (KTU84P), although it works on Android M.
  # Either upgrade the version of Android on the Trybot servers or determine
  # if there is a way to run this agent on Android KTU84P.
  @decorators.Disabled
  def testGetCategories(self):
    curr_browser = self.GetChromeProcessID()
    if curr_browser == None:
      self.StartBrowser()

    categories = \
        chrome_tracing_agent.ChromeTracingAgent.GetCategories(
            self.device, self.package_info)

    self.assertEquals(len(categories), 2)
    self.assertTrue(categories[0])
    self.assertTrue(categories[1])

  # TODO(washingtonp): This test is pretty flaky on the version of Android
  # currently on the Trybot servers (KTU84P), although it works on Android M.
  # Either upgrade the version of Android on the Trybot servers or determine
  # if there is a way to run this agent on Android KTU84P.
  @decorators.Disabled
  def testTracing(self):
    curr_browser = self.GetChromeProcessID()
    if curr_browser == None:
      self.StartBrowser()

    categories = '*'
    ring_buffer = False
    agent = chrome_tracing_agent.ChromeTracingAgent(self.device,
                                                    self.package_info,
                                                    ring_buffer)
    agent.StartAgentTracing(chrome_tracing_agent.ChromeConfig(categories, None,
        None, None, None, None, None, None, ring_buffer, self.device,
        self.package_info))
    agent.StopAgentTracing()
    result = agent.GetResults()
    json.loads(result.raw_data)