Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / tools / telemetry / telemetry / core / platform / network_controller.py
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 class NetworkController(object):
6   """Control network settings and servers to simulate the Web.
7
8   Network changes include forwarding device ports to host platform ports.
9   Web Page Replay is used to record and replay HTTP/HTTPS responses.
10   """
11
12   def __init__(self, network_controller_backend):
13     self._network_controller_backend = network_controller_backend
14
15   def SetReplayArgs(self, archive_path, wpr_mode, netsim, extra_wpr_args,
16                     make_javascript_deterministic=False):
17     """Save the arguments needed for replay."""
18     self._network_controller_backend.SetReplayArgs(
19         archive_path, wpr_mode, netsim, extra_wpr_args,
20         make_javascript_deterministic)
21
22   def UpdateReplayForExistingBrowser(self):
23     """Restart replay if needed for an existing browser.
24
25     TODO(slamm): Drop this method when the browser_backend dependencies are
26     moved to the platform. https://crbug.com/423962
27     """
28     self._network_controller_backend.UpdateReplay()