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

Unified Diff: telemetry/telemetry/internal/platform/tracing_agent/chrome_tracing_agent_unittest.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
« no previous file with comments | « telemetry/telemetry/internal/platform/tracing_agent/chrome_tracing_agent.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/telemetry/internal/platform/tracing_agent/chrome_tracing_agent_unittest.py
diff --git a/telemetry/telemetry/internal/platform/tracing_agent/chrome_tracing_agent_unittest.py b/telemetry/telemetry/internal/platform/tracing_agent/chrome_tracing_agent_unittest.py
index fb531ca514714f98b8f5a4b151ba66eac7482ced..b4d3c519fe9be292a40e72dc59822dba05247ac2 100644
--- a/telemetry/telemetry/internal/platform/tracing_agent/chrome_tracing_agent_unittest.py
+++ b/telemetry/telemetry/internal/platform/tracing_agent/chrome_tracing_agent_unittest.py
@@ -11,6 +11,9 @@ from telemetry.internal.platform.tracing_agent import chrome_tracing_agent
from telemetry.internal.platform.tracing_agent import (
chrome_tracing_devtools_manager)
from telemetry.timeline import tracing_config
+from telemetry.core import cros_interface
+from telemetry.testing import options_for_unittests
+
from devil.android import device_utils
@@ -36,6 +39,18 @@ class FakeAndroidPlatformBackend(FakePlatformBackend):
def GetOSName(self):
return 'android'
+class FakeCrOSPlatformBackend(FakePlatformBackend):
+ def __init__(self):
+ super(FakeCrOSPlatformBackend, self).__init__()
+ remote = options_for_unittests.GetCopy().cros_remote
+ remote_ssh_port = options_for_unittests.GetCopy().cros_remote_ssh_port
+ self.cri = cros_interface.CrOSInterface(
+ remote, remote_ssh_port,
+ options_for_unittests.GetCopy().cros_ssh_identity)
+
+ def GetOSName(self):
+ return 'chromeos'
+
class FakeDesktopPlatformBackend(FakePlatformBackend):
def GetOSName(self):
system = platform.system()
@@ -322,6 +337,30 @@ class ChromeTracingAgentTest(unittest.TestCase):
self.assertFalse(platform_backend.device.PathExists(config_file_path))
self.assertIsNone(agent.trace_config_file)
+ @decorators.Enabled('chromeos')
+ def testCreateAndRemoveTraceConfigFileOnCrOS(self):
+ platform_backend = FakeCrOSPlatformBackend()
+ cri = platform_backend.cri
+ agent = chrome_tracing_agent.ChromeTracingAgent(platform_backend)
+ self.assertIsNone(agent.trace_config_file)
+
+ config = tracing_config.TracingConfig()
+ agent._CreateTraceConfigFile(config)
+ self.assertIsNotNone(agent.trace_config_file)
+ self.assertTrue(cri.FileExistsOnDevice(agent.trace_config_file))
+ config_file_str = cri.GetFileContents(agent.trace_config_file)
+ self.assertEqual(agent._CreateTraceConfigFileString(config),
+ config_file_str.strip())
+
+ config_file_path = agent.trace_config_file
+ agent._RemoveTraceConfigFile()
+ self.assertFalse(cri.FileExistsOnDevice(config_file_path))
+ self.assertIsNone(agent.trace_config_file)
+ # robust to multiple file removal
+ agent._RemoveTraceConfigFile()
+ self.assertFalse(cri.FileExistsOnDevice(config_file_path))
+ self.assertIsNone(agent.trace_config_file)
+
@decorators.Enabled('linux', 'mac', 'win')
def testCreateAndRemoveTraceConfigFileOnDesktop(self):
platform_backend = FakeDesktopPlatformBackend()
« no previous file with comments | « telemetry/telemetry/internal/platform/tracing_agent/chrome_tracing_agent.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698