Index: tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py |
diff --git a/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py b/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py |
index dd52125cbb01b50a0319436ffb173df15bb13523..215731c969994dbddafa5c5bfdb196f59521ae86 100644 |
--- a/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py |
+++ b/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py |
@@ -216,6 +216,26 @@ class TracingBackend(object): |
self._tracing_data = [] |
return result |
+ def ConfigureSyntheticDelays(self, delays, timeout=10): |
+ """Configure synthetic delays for all browser processes. |
+ |
+ Args: |
+ delays: A dictionary of delays to configure. Each delay can have the |
+ following properties: |
+ target_duration: How many seconds the delay point should execute. |
+ mode: Delay mode; one of 'static', 'oneshot' or 'alternating'. |
+ timeout: Time to wait for operation to complete. |
+ """ |
+ assert not self._IsTracing() |
+ req = { |
+ 'method': 'Tracing.configureSyntheticDelays', |
+ 'params': {'delays': delays} |
+ } |
+ self._conn.SendRequest(req, timeout) |
+ |
+ # Wait for the delay configuration acknowledgement synchronously. |
+ self._TracingReader() |
+ |
def _TracingReader(self): |
while self._conn.socket: |
try: |
@@ -234,6 +254,8 @@ class TracingBackend(object): |
logging.warning('Unexpected type in tracing data') |
elif 'Tracing.tracingComplete' == res.get('method'): |
break |
+ elif 'Tracing.configureSyntheticDelaysComplete' == res.get('method'): |
+ break |
except websocket.WebSocketTimeoutException as e: |
logging.warning('Unusual timeout waiting for tracing response (%s).', |
e) |