| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 def CanMonitorThermalThrottling(self): | 49 def CanMonitorThermalThrottling(self): |
| 50 return False | 50 return False |
| 51 | 51 |
| 52 def IsThermallyThrottled(self): | 52 def IsThermallyThrottled(self): |
| 53 return False | 53 return False |
| 54 | 54 |
| 55 def HasBeenThermallyThrottled(self): | 55 def HasBeenThermallyThrottled(self): |
| 56 return False | 56 return False |
| 57 | 57 |
| 58 def GetDeviceTypeName(self): | 58 def GetDeviceTypeName(self): |
| 59 raise NotImplementedError | 59 return 'FakeDevice' |
| 60 | 60 |
| 61 def GetArchName(self): | 61 def GetArchName(self): |
| 62 raise NotImplementedError | 62 raise NotImplementedError |
| 63 | 63 |
| 64 def GetOSName(self): | 64 def GetOSName(self): |
| 65 raise NotImplementedError | 65 return 'FakeOS' |
| 66 | 66 |
| 67 def GetOSVersionName(self): | 67 def GetOSVersionName(self): |
| 68 raise NotImplementedError | 68 raise NotImplementedError |
| 69 | 69 |
| 70 def StopAllLocalServers(self): | 70 def StopAllLocalServers(self): |
| 71 pass | 71 pass |
| 72 | 72 |
| 73 def WaitForTemperature(self, _): | 73 def WaitForTemperature(self, _): |
| 74 pass | 74 pass |
| 75 | 75 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 def StopTracing(self): | 295 def StopTracing(self): |
| 296 self._is_tracing = False | 296 self._is_tracing = False |
| 297 | 297 |
| 298 @property | 298 @property |
| 299 def is_tracing_running(self): | 299 def is_tracing_running(self): |
| 300 return self._is_tracing | 300 return self._is_tracing |
| 301 | 301 |
| 302 def ClearStateIfNeeded(self): | 302 def ClearStateIfNeeded(self): |
| 303 pass | 303 pass |
| 304 | 304 |
| 305 def IsChromeTracingSupported(self): |
| 306 return True |
| 307 |
| 305 | 308 |
| 306 class _FakeNetworkController(object): | 309 class _FakeNetworkController(object): |
| 307 def __init__(self): | 310 def __init__(self): |
| 308 self.wpr_mode = None | 311 self.wpr_mode = None |
| 309 self.extra_wpr_args = None | 312 self.extra_wpr_args = None |
| 310 self.is_initialized = False | 313 self.is_initialized = False |
| 311 self.is_open = False | 314 self.is_open = False |
| 312 self.use_live_traffic = None | 315 self.use_live_traffic = None |
| 313 | 316 |
| 314 def InitializeIfNeeded(self, use_live_traffic=False): | 317 def InitializeIfNeeded(self, use_live_traffic=False): |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 | 530 |
| 528 def __del__(self): | 531 def __del__(self): |
| 529 self.Restore() | 532 self.Restore() |
| 530 | 533 |
| 531 def Restore(self): | 534 def Restore(self): |
| 532 if self._module: | 535 if self._module: |
| 533 self._module.time = self._actual_time | 536 self._module.time = self._actual_time |
| 534 self._module = None | 537 self._module = None |
| 535 self._actual_time = None | 538 self._actual_time = None |
| 536 | 539 |
| OLD | NEW |