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 5class 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 Open(self, wpr_mode, extra_wpr_args): 16 self._network_controller_backend.Open(wpr_mode, extra_wpr_args) 17 18 @property 19 def is_open(self): 20 return self._network_controller_backend.is_open 21 22 def Close(self): 23 self._network_controller_backend.Close() 24 25 def StartReplay(self, archive_path, make_javascript_deterministic=False): 26 self._network_controller_backend.StartReplay( 27 archive_path, make_javascript_deterministic) 28 29 def StopReplay(self): 30 self._network_controller_backend.StopReplay() 31