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

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

Issue 2160953003: [Telemetry][Tracing] Split StopTracing and CollectTraceData for Chrome Tracing Agent. (Closed) Base URL: git@github.com:catapult-project/catapult@master
Patch Set: [Telemetry][Tracing] Split StopTracing and CollectTraceData for Chrome Tracing Agent. Created 4 years, 5 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_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 388c121601353c7d08ced1de6ddc4f1489643376..fb531ca514714f98b8f5a4b151ba66eac7482ced 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
@@ -58,6 +58,7 @@ class FakeDevtoolsClient(object):
self.is_tracing_running = False
self.remote_port = remote_port
self.will_raise_exception_in_stop_tracing = False
+ self.collected = False
def IsAlive(self):
return self.is_alive
@@ -66,12 +67,16 @@ class FakeDevtoolsClient(object):
del trace_options, timeout # unused
self.is_tracing_running = True
- def StopChromeTracing(self, trace_data_builder):
- del trace_data_builder # unused
+ def StopChromeTracing(self):
self.is_tracing_running = False
if self.will_raise_exception_in_stop_tracing:
raise Exception
+ def CollectChromeTracingData(self, trace_data_builder, timeout=30):
+ del trace_data_builder # unused
+ del timeout # unused
+ self.collected = True
+
def IsChromeTracingSupported(self):
return True
@@ -190,19 +195,25 @@ class ChromeTracingAgentTest(unittest.TestCase):
# port as devtool 2
self.assertFalse(devtool4.is_tracing_running)
+
+ self.assertFalse(devtool1.collected)
self.StopTracing(tracing_agent1)
+ self.assertTrue(devtool1.collected)
self.assertFalse(devtool1.is_tracing_running)
self.assertFalse(devtool2.is_tracing_running)
self.assertFalse(devtool3.is_tracing_running)
self.assertFalse(devtool4.is_tracing_running)
+
# Test that it should be ok to start & stop tracing on platform1 again.
tracing_agent1 = self.StartTracing(self.platform1)
self.StopTracing(tracing_agent1)
tracing_agent2 = self.StartTracing(self.platform2)
self.assertTrue(devtool4.is_tracing_running)
+ self.assertFalse(devtool4.collected)
self.StopTracing(tracing_agent2)
self.assertFalse(devtool4.is_tracing_running)
+ self.assertTrue(devtool4.collected)
def testFlushTracing(self):
devtool1 = FakeDevtoolsClient(1)

Powered by Google App Engine
This is Rietveld 408576698