From 3579f8fba28dc636dce1bb648574718d82bac3b8 Mon Sep 17 00:00:00 2001 From: "skyostil@chromium.org" Date: Fri, 13 Jun 2014 21:53:30 +0000 Subject: 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 --- tools/android/adb_profile_chrome/perf_controller_unittest.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tools/android/adb_profile_chrome/perf_controller_unittest.py') 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()) -- cgit v1.1