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

Unified Diff: telemetry/telemetry/internal/platform/tracing_controller_backend_unittest.py

Issue 2006703003: [clock sync] Add the TELEMETRY clock domain to the controller's trace (Closed) Base URL: git@github.com:catapult-project/catapult.git@master
Patch Set: Created 4 years, 7 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_controller_backend.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_controller_backend_unittest.py
diff --git a/telemetry/telemetry/internal/platform/tracing_controller_backend_unittest.py b/telemetry/telemetry/internal/platform/tracing_controller_backend_unittest.py
index bcec23dd3ff8e7107dd061fb06508a396c1c844e..89910e0945139fe9d1b5ae07dcb6feb3acfdbabf 100644
--- a/telemetry/telemetry/internal/platform/tracing_controller_backend_unittest.py
+++ b/telemetry/telemetry/internal/platform/tracing_controller_backend_unittest.py
@@ -89,11 +89,20 @@ class FakeTracingAgentNoStartAndClockSync(FakeTracingAgentBase):
class TracingControllerBackendTest(unittest.TestCase):
- def _getControllerLogAsList(self, data):
- return data.GetTraceFor(trace_data.TELEMETRY_PART)
+ def _getControllerEventsAslist(self, data):
+ telemetry_trace = data.GetTraceFor(trace_data.TELEMETRY_PART)
+ if not telemetry_trace:
+ return []
+ return telemetry_trace["traceEvents"]
+
+ def _getControllerClockDomain(self, data):
+ telemetry_trace = data.GetTraceFor(trace_data.TELEMETRY_PART)
+ if not telemetry_trace or not telemetry_trace["metadata"]:
+ return ""
+ return telemetry_trace["metadata"]["clock-domain"]
def _getSyncCount(self, data):
- return len([entry for entry in self._getControllerLogAsList(data)
+ return len([entry for entry in self._getControllerEventsAslist(data)
if entry.get('name') == 'clock_sync'])
def setUp(self):
@@ -153,7 +162,7 @@ class TracingControllerBackendTest(unittest.TestCase):
self.assertTrue(self.controller.is_tracing_running)
data = self.controller.StopTracing()
self.assertEqual(self._getSyncCount(data), 1)
- sync_event_one = [x for x in self._getControllerLogAsList(data)
+ sync_event_one = [x for x in self._getControllerEventsAslist(data)
if x.get('name') == 'clock_sync'][0]
self.assertFalse(self.controller.is_tracing_running)
self.assertEqual(self.controller._trace_log, None)
@@ -162,7 +171,7 @@ class TracingControllerBackendTest(unittest.TestCase):
self.assertTrue(self.controller.is_tracing_running)
data = self.controller.StopTracing()
self.assertEqual(self._getSyncCount(data), 1)
- sync_event_two = [x for x in self._getControllerLogAsList(data)
+ sync_event_two = [x for x in self._getControllerEventsAslist(data)
if x.get('name') == 'clock_sync'][0]
self.assertFalse(self.controller.is_tracing_running)
self.assertFalse(self.controller._trace_log, None)
@@ -247,6 +256,7 @@ class TracingControllerBackendTest(unittest.TestCase):
data = self.controller.StopTracing()
self.assertFalse(self.controller.is_tracing_running)
self.assertEquals(self._getSyncCount(data), 2)
+ self.assertEquals(self._getControllerClockDomain(data), "TELEMETRY")
@decorators.Isolated
def testMultipleAgents(self):
@@ -289,7 +299,8 @@ class TracingControllerBackendTest(unittest.TestCase):
data = self.controller.StopTracing()
self.assertFalse(self.controller.is_tracing_running)
self.assertEquals(self._getSyncCount(data), 1)
- log = self._getControllerLogAsList(data)
+ self.assertEquals(self._getControllerClockDomain(data), "TELEMETRY")
+ log = self._getControllerEventsAslist(data)
for entry in log:
if entry.get('name') == 'clock_sync':
self.assertEqual(entry['args']['sync_id'], sync_id)
@@ -315,6 +326,7 @@ class TracingControllerBackendTest(unittest.TestCase):
data = self.controller.StopTracing()
self.assertFalse(self.controller.is_tracing_running)
self.assertEquals(self._getSyncCount(data), 4)
+ self.assertEquals(self._getControllerClockDomain(data), "TELEMETRY")
@decorators.Isolated
def testIssueClockSyncMarker_tracingNotControllable(self):
« no previous file with comments | « telemetry/telemetry/internal/platform/tracing_controller_backend.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698