OLD | NEW |
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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 self.use_live_traffic = None | 366 self.use_live_traffic = None |
367 | 367 |
368 def InitializeIfNeeded(self, use_live_traffic=False): | 368 def InitializeIfNeeded(self, use_live_traffic=False): |
369 self.use_live_traffic = use_live_traffic | 369 self.use_live_traffic = use_live_traffic |
370 | 370 |
371 def UpdateTrafficSettings( | 371 def UpdateTrafficSettings( |
372 self, round_trip_latency_ms=None, | 372 self, round_trip_latency_ms=None, |
373 download_bandwidth_kbps=None, upload_bandwidth_kbps=None): | 373 download_bandwidth_kbps=None, upload_bandwidth_kbps=None): |
374 pass | 374 pass |
375 | 375 |
376 def Open(self, wpr_mode, extra_wpr_args, use_wpr_go=False): | 376 def Open(self, wpr_mode, extra_wpr_args): |
377 del use_wpr_go # Unused. | |
378 self.wpr_mode = wpr_mode | 377 self.wpr_mode = wpr_mode |
379 self.extra_wpr_args = extra_wpr_args | 378 self.extra_wpr_args = extra_wpr_args |
380 self.is_open = True | 379 self.is_open = True |
381 | 380 |
382 def Close(self): | 381 def Close(self): |
383 self.wpr_mode = None | 382 self.wpr_mode = None |
384 self.extra_wpr_args = None | 383 self.extra_wpr_args = None |
385 self.is_initialized = False | 384 self.is_initialized = False |
386 self.is_open = False | 385 self.is_open = False |
387 | 386 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 self._elapsed_time = time | 581 self._elapsed_time = time |
583 | 582 |
584 def __del__(self): | 583 def __del__(self): |
585 self.Restore() | 584 self.Restore() |
586 | 585 |
587 def Restore(self): | 586 def Restore(self): |
588 if self._module: | 587 if self._module: |
589 self._module.time = self._actual_time | 588 self._module.time = self._actual_time |
590 self._module = None | 589 self._module = None |
591 self._actual_time = None | 590 self._actual_time = None |
OLD | NEW |