Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: telemetry/telemetry/testing/fakes/__init__.py

Issue 2346093002: [Telemetry] Add API for updating ts_proxy_server's traffic settings (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « telemetry/telemetry/page/traffic_setting.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 """Provides fakes for several of Telemetry's internal objects. 5 """Provides fakes for several of Telemetry's internal objects.
6 6
7 These allow code like story_runner and Benchmark to be run and tested 7 These allow code like story_runner and Benchmark to be run and tested
8 without compiling or starting a browser. Class names prepended with an 8 without compiling or starting a browser. Class names prepended with an
9 underscore are intended to be implementation details, and should not 9 underscore are intended to be implementation details, and should not
10 be subclassed; however, some, like _FakeBrowser, have public APIs that 10 be subclassed; however, some, like _FakeBrowser, have public APIs that
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 def __init__(self): 290 def __init__(self):
291 self.wpr_mode = None 291 self.wpr_mode = None
292 self.extra_wpr_args = None 292 self.extra_wpr_args = None
293 self.is_replay_active = False 293 self.is_replay_active = False
294 self.is_open = False 294 self.is_open = False
295 self.use_live_traffic = None 295 self.use_live_traffic = None
296 296
297 def InitializeIfNeeded(self, use_live_traffic=False): 297 def InitializeIfNeeded(self, use_live_traffic=False):
298 self.use_live_traffic = use_live_traffic 298 self.use_live_traffic = use_live_traffic
299 299
300 def UpdateTrafficSettings(self, round_trip_latency_ms=None,
301 download_bandwidth_kbps=None, upload_bandwidth_kbps=None):
302 pass
303
300 def Open(self, wpr_mode, extra_wpr_args): 304 def Open(self, wpr_mode, extra_wpr_args):
301 self.wpr_mode = wpr_mode 305 self.wpr_mode = wpr_mode
302 self.extra_wpr_args = extra_wpr_args 306 self.extra_wpr_args = extra_wpr_args
303 self.is_open = True 307 self.is_open = True
304 308
305 def Close(self): 309 def Close(self):
306 self.wpr_mode = None 310 self.wpr_mode = None
307 self.extra_wpr_args = None 311 self.extra_wpr_args = None
308 self.is_replay_active = False 312 self.is_replay_active = False
309 self.is_open = False 313 self.is_open = False
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 473
470 self._notifications.pop(0) 474 self._notifications.pop(0)
471 self._mock_timer.SetTime(time + 1) 475 self._mock_timer.SetTime(time + 1)
472 if kind == self._NOTIFICATION_EVENT: 476 if kind == self._NOTIFICATION_EVENT:
473 self._handler(response) 477 self._handler(response)
474 elif kind == self._NOTIFICATION_CALLBACK: 478 elif kind == self._NOTIFICATION_CALLBACK:
475 callback = self._pending_callbacks.get(response['method']).pop(0) 479 callback = self._pending_callbacks.get(response['method']).pop(0)
476 callback(response) 480 callback(response)
477 else: 481 else:
478 raise Exception('Unexpected response type') 482 raise Exception('Unexpected response type')
OLDNEW
« no previous file with comments | « telemetry/telemetry/page/traffic_setting.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698