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

Unified Diff: tools/telemetry/telemetry/page/actions/set_synthetic_delays.py

Issue 99543002: Make it possible to configure synthetic delays through Devtools (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | « tools/telemetry/telemetry/core/browser.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/page/actions/set_synthetic_delays.py
diff --git a/tools/telemetry/telemetry/page/actions/set_synthetic_delays.py b/tools/telemetry/telemetry/page/actions/set_synthetic_delays.py
new file mode 100644
index 0000000000000000000000000000000000000000..6a3e1cb61f0f0a44c10568738d8d18f9196959f1
--- /dev/null
+++ b/tools/telemetry/telemetry/page/actions/set_synthetic_delays.py
@@ -0,0 +1,30 @@
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+from telemetry.page.actions import page_action
+
+class SetSyntheticDelaysAction(page_action.PageAction):
+ """Allows pages to configure synthetic delays in various parts of the browser.
+
+ Synthetic delays can be used to reliably simulate heavy workloads in different
+ parts of the input and graphics pipeline. For more information see
+ base/debug/trace_event_synthetic_delay.h. Prior to configuring the new delays,
+ all existing delays are reset.
+
+ 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'.
+ """
+ def __init__(self, attributes=None):
+ super(SetSyntheticDelaysAction, self).__init__(attributes)
+
+ def WillRunAction(self, page, tab):
+ # Fail if browser doesn't support synthetic delays.
+ if not tab.browser.supports_synthetic_delays:
+ raise page_action.PageActionNotSupported(
+ 'Synthetic delays not supported for this browser')
+
+ def RunAction(self, page, tab, previous_action):
+ tab.browser.ConfigureSyntheticDelays(getattr(self, 'delays', {}), 10)
« no previous file with comments | « tools/telemetry/telemetry/core/browser.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698