| 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)
|
|
|