Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Unified Diff: telemetry/telemetry/internal/platform/tracing_agent/chrome_tracing_agent.py

Issue 2223963003: Add trace config file for Chrome on CrOS (Closed) Base URL: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git@master
Patch Set: Added trace config file for Chrome on CrOS Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: telemetry/telemetry/internal/platform/tracing_agent/chrome_tracing_agent.py
diff --git a/telemetry/telemetry/internal/platform/tracing_agent/chrome_tracing_agent.py b/telemetry/telemetry/internal/platform/tracing_agent/chrome_tracing_agent.py
index 1604c3d04d831522c0af5b69a67f7cc53b323695..a878dfc1c494440f0f71ca7b0869eccfb19e96c4 100644
--- a/telemetry/telemetry/internal/platform/tracing_agent/chrome_tracing_agent.py
+++ b/telemetry/telemetry/internal/platform/tracing_agent/chrome_tracing_agent.py
@@ -18,11 +18,12 @@ from telemetry.internal.platform.tracing_agent import (
chrome_tracing_devtools_manager)
_DESKTOP_OS_NAMES = ['linux', 'mac', 'win']
-_STARTUP_TRACING_OS_NAMES = _DESKTOP_OS_NAMES + ['android']
+_STARTUP_TRACING_OS_NAMES = _DESKTOP_OS_NAMES + ['android', 'chromeos']
# The trace config file path should be the same as specified in
# src/components/tracing/trace_config_file.[h|cc]
_CHROME_TRACE_CONFIG_DIR_ANDROID = '/data/local/'
+_CHROME_TRACE_CONFIG_DIR_CROS = '/tmp/'
_CHROME_TRACE_CONFIG_FILE_NAME = 'chrome-trace-config.json'
@@ -255,6 +256,16 @@ class ChromeTracingAgent(tracing_agent.TracingAgent):
# The config file has fixed path on Android. We need to ensure it is
# always cleaned up.
atexit_with_log.Register(self._RemoveTraceConfigFile)
+ elif self._platform_backend.GetOSName() == 'chromeos':
+ self._trace_config_file = os.path.join(_CHROME_TRACE_CONFIG_DIR_CROS,
+ _CHROME_TRACE_CONFIG_FILE_NAME)
+ cri = self._platform_backend.cri
+ cri.PushContents(self._CreateTraceConfigFileString(config),
+ self._trace_config_file)
+ cri.Chown(self._trace_config_file)
+ # The config file has fixed path on CrOS. We need to ensure it is
+ # always cleaned up.
+ atexit_with_log.Register(self._RemoveTraceConfigFile)
elif self._platform_backend.GetOSName() in _DESKTOP_OS_NAMES:
self._trace_config_file = os.path.join(tempfile.mkdtemp(),
_CHROME_TRACE_CONFIG_FILE_NAME)
@@ -274,6 +285,8 @@ class ChromeTracingAgent(tracing_agent.TracingAgent):
self._platform_backend.device.RunShellCommand(
['rm', '-f', self._trace_config_file], check_return=True,
as_root=True)
+ elif self._platform_backend.GetOSName() == 'chromeos':
+ self._platform_backend.cri.RmRF(self._trace_config_file)
elif self._platform_backend.GetOSName() in _DESKTOP_OS_NAMES:
if os.path.exists(self._trace_config_file):
os.remove(self._trace_config_file)

Powered by Google App Engine
This is Rietveld 408576698