| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import unittest | 5 import unittest |
| 6 | 6 |
| 7 from telemetry.internal.util import ts_proxy_server | 7 from telemetry.internal.util import ts_proxy_server |
| 8 | 8 |
| 9 class TsProxyServerTest(unittest.TestCase): | 9 class TsProxyServerTest(unittest.TestCase): |
| 10 def testParseTsProxyPort(self): | 10 def testParseTsProxyPort(self): |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 with ts_proxy_server.TsProxyServer() as server: | 25 with ts_proxy_server.TsProxyServer() as server: |
| 26 self.assertIsNotNone(server.port) | 26 self.assertIsNotNone(server.port) |
| 27 with ts_proxy_server.TsProxyServer(None, 37124, 37125) as server: | 27 with ts_proxy_server.TsProxyServer(None, 37124, 37125) as server: |
| 28 self.assertIsNotNone(server.port) | 28 self.assertIsNotNone(server.port) |
| 29 | 29 |
| 30 def testSmokeUpdatingOutboundPorts(self): | 30 def testSmokeUpdatingOutboundPorts(self): |
| 31 with ts_proxy_server.TsProxyServer() as server: | 31 with ts_proxy_server.TsProxyServer() as server: |
| 32 self.assertIsNotNone(server.port) | 32 self.assertIsNotNone(server.port) |
| 33 server.UpdateOutboundPorts(31242, 14220) | 33 server.UpdateOutboundPorts(31242, 14220) |
| 34 | 34 |
| 35 def testSmokeUpdatingOutboundPortsInvalid(self): | 35 def testSmokeUpdateOutboundPortsInvalid(self): |
| 36 with ts_proxy_server.TsProxyServer() as server: | 36 with ts_proxy_server.TsProxyServer() as server: |
| 37 self.assertIsNotNone(server.port) | 37 self.assertIsNotNone(server.port) |
| 38 with self.assertRaises(AssertionError): | 38 with self.assertRaises(AssertionError): |
| 39 server.UpdateOutboundPorts(31242, 'abcde') | 39 server.UpdateOutboundPorts(31242, 'abcde') |
| 40 |
| 41 def testSmokeUpdateTrafficSettings(self): |
| 42 with ts_proxy_server.TsProxyServer() as server: |
| 43 server.UpdateTrafficSettings(round_trip_latency_ms=100) |
| 44 server.UpdateTrafficSettings(download_bandwidth_kbps=5000) |
| 45 server.UpdateTrafficSettings(upload_bandwidth_kbps=2000) |
| 46 server.UpdateTrafficSettings( |
| 47 round_trip_latency_ms=200, download_bandwidth_kbps=500, |
| 48 upload_bandwidth_kbps=2000) |
| OLD | NEW |