summaryrefslogtreecommitdiffstats
path: root/tools/android/adb_profile_chrome/perf_controller_unittest.py
diff options
context:
space:
mode:
authorskyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-13 21:53:30 +0000
committerskyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-13 21:53:30 +0000
commit3579f8fba28dc636dce1bb648574718d82bac3b8 (patch)
tree530f70d4ec2019760bf1061ba28c16ae86899367 /tools/android/adb_profile_chrome/perf_controller_unittest.py
parent59828d3af3f80d5d88c669f58a731a0283864d12 (diff)
downloadchromium_src-3579f8fba28dc636dce1bb648574718d82bac3b8.zip
chromium_src-3579f8fba28dc636dce1bb648574718d82bac3b8.tar.gz
chromium_src-3579f8fba28dc636dce1bb648574718d82bac3b8.tar.bz2
Make perf work in adb_profile_chrome when JSON converter isn't present
When the JSON converter isn't present, the user can still manually inspect perf recordings. BUG=375754 TEST=tools/android/adb_profile_chrome/run_tests Review URL: https://codereview.chromium.org/337543002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277095 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/android/adb_profile_chrome/perf_controller_unittest.py')
-rw-r--r--tools/android/adb_profile_chrome/perf_controller_unittest.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/android/adb_profile_chrome/perf_controller_unittest.py b/tools/android/adb_profile_chrome/perf_controller_unittest.py
index 381e441..eac12eba6 100644
--- a/tools/android/adb_profile_chrome/perf_controller_unittest.py
+++ b/tools/android/adb_profile_chrome/perf_controller_unittest.py
@@ -7,6 +7,9 @@ import json
from adb_profile_chrome import controllers_unittest
from adb_profile_chrome import perf_controller
+from adb_profile_chrome import ui
+
+from pylib import constants
class PerfProfilerControllerTest(controllers_unittest.BaseControllerTest):
@@ -20,6 +23,7 @@ class PerfProfilerControllerTest(controllers_unittest.BaseControllerTest):
def testTracing(self):
if not perf_controller.PerfProfilerController.IsSupported():
return
+ ui.EnableTestMode()
categories = ['cycles']
controller = perf_controller.PerfProfilerController(self.device,
categories)
@@ -31,6 +35,14 @@ class PerfProfilerControllerTest(controllers_unittest.BaseControllerTest):
controller.StopTracing()
result = controller.PullTrace()
+ # Perf-to-JSON conversion can fail if dependencies are missing.
+ if not result:
+ perf_script_path = os.path.join(constants.DIR_SOURCE_ROOT,
+ 'tools', 'telemetry', 'telemetry', 'core', 'platform', 'profiler',
+ 'perf_vis', 'perf_to_tracing.py')
+ assert not os.path.exists(perf_script_path)
+ return
+
try:
with open(result) as f:
json.loads(f.read())