| Index: tools/telemetry/telemetry/core/network_controller.py
|
| diff --git a/tools/telemetry/telemetry/core/network_controller.py b/tools/telemetry/telemetry/core/network_controller.py
|
| index 3df2e92f7e304451ae09047afa971ea7d8e328b5..116f67459fe7f76b99aed3d1be465c220d9bb19f 100644
|
| --- a/tools/telemetry/telemetry/core/network_controller.py
|
| +++ b/tools/telemetry/telemetry/core/network_controller.py
|
| @@ -13,21 +13,46 @@ class NetworkController(object):
|
| def __init__(self, network_controller_backend):
|
| self._network_controller_backend = network_controller_backend
|
|
|
| - def SetReplayArgs(self,
|
| - archive_path,
|
| - wpr_mode,
|
| - netsim,
|
| - extra_wpr_args,
|
| - make_javascript_deterministic=False):
|
| - """Save the arguments needed for replay."""
|
| - self._network_controller_backend.SetReplayArgs(
|
| - archive_path, wpr_mode, netsim, extra_wpr_args,
|
| - make_javascript_deterministic)
|
| -
|
| - def UpdateReplayForExistingBrowser(self):
|
| - """Restart replay if needed for an existing browser.
|
| -
|
| - TODO(slamm): Drop this method when the browser_backend dependencies are
|
| - moved to the platform. https://crbug.com/423962
|
| + def Open(self, wpr_mode, netsim=None, extra_wpr_args=None):
|
| + """Configure and start any changes needed for network control.
|
| +
|
| + This may, as needed, install certificates or start port forwarding for
|
| + remote platforms. After network interactions are over, clients are expected
|
| + to call the Close method.
|
| +
|
| + Args:
|
| + wpr_mode: a mode for web page replay; available options are
|
| + wpr_modes.WPR_OFF, wpr_modes.APPEND, wpr_modes.WPR_REPLAY, or
|
| + wpr_modes.WPR_RECORD.
|
| + netsim: an optional net_config string (e.g. 'dialup', '3g', 'dsl',
|
| + 'cable', 'fios').
|
| + extra_wpr_args: an optional sequence of extra arguments for web page
|
| + replay.
|
| + """
|
| + self._network_controller_backend.Open(wpr_mode, netsim, extra_wpr_args)
|
| +
|
| + def StartReplay(self, archive_path, make_javascript_deterministic=False):
|
| + """Start (or reuse) a replay server from a specific archive.
|
| +
|
| + It will implicitly stop a previous replay if the archive_path or JavaScript
|
| + options differ.
|
| +
|
| + Args:
|
| + archive_path: a path to a specific WPR archive.
|
| + make_javascript_deterministic: True if replay should inject a script
|
| + to make JavaScript behanve deterministically (e.g., override Date()).
|
| + """
|
| + self._network_controller_backend.StartReplay(
|
| + archive_path, make_javascript_deterministic)
|
| +
|
| + def StopReplay(self):
|
| + """Close the currently active replay server, if any."""
|
| + self._network_controller_backend.StopReplay()
|
| +
|
| + def Close(self):
|
| + """Undo any changes that were applied for network control.
|
| +
|
| + This also stops any port forwarders and implicitly calls StopReplay
|
| + if needed.
|
| """
|
| - self._network_controller_backend.UpdateReplay()
|
| + self._network_controller_backend.Close()
|
|
|