telemetry.testing.fakes | index telemetry/testing/fakes/__init__.py

`Provides fakes for several of Telemetry's internal objects.
These allow code like story_runner and Benchmark to be run and tested
without compiling or starting a browser. Class names prepended with an
underscore are intended to be implementation details, and should not
be subclassed; however, some, like _FakeBrowser, have public APIs that
may need to be called in tests.`

Package Contents
`` |  |

Classes
`` |  | __builtin__.object FakeHTTPServer FakeInspectorWebsocket FakePlatform FakeLinuxPlatform FakePossibleBrowser telemetry.internal.platform.system_info.SystemInfo(__builtin__.object) FakeSystemInfo telemetry.page.shared_page_state.SharedPageState(telemetry.story.shared_state.SharedState) FakeSharedPageState
class FakeHTTPServer(__builtin__.object)
`` |  | Methods defined here: UrlOf(self, url) Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class FakeInspectorWebsocket(__builtin__.object)
`` |  | Methods defined here: AddAsyncResponse(self, method, result, time) AddEvent(self, method, params, time) AddResponseHandler(self, method, handler) AsyncRequest(self, request, callback) Connect(self, _) DispatchNotifications(self, timeout) RegisterDomain(self, _, handler) SendAndIgnoreResponse(self, request) SyncRequest(self, request, *_args, **_kwargs) __init__(self, mock_timer) Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class FakeLinuxPlatform(FakePlatform)
`` |  | Method resolution order: FakeLinuxPlatform FakePlatform __builtin__.object Methods defined here: CanTakeScreenshot(self) GetArchName(self) GetDeviceTypeName(self) GetOSName(self) GetOSVersionName(self) SetHTTPServerDirectories(self, paths) TakeScreenshot(self, file_path) __init__(self) Data descriptors defined here: is_host_platform Methods inherited from FakePlatform: CanMonitorThermalThrottling(self) HasBeenThermallyThrottled(self) IsThermallyThrottled(self) StopAllLocalServers(self) Data descriptors inherited from FakePlatform: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` network_controller tracing_controller
class FakePlatform(__builtin__.object)
`` |  | Methods defined here: CanMonitorThermalThrottling(self) GetArchName(self) GetDeviceTypeName(self) GetOSName(self) GetOSVersionName(self) HasBeenThermallyThrottled(self) IsThermallyThrottled(self) StopAllLocalServers(self) Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` is_host_platform network_controller tracing_controller
class FakePossibleBrowser(__builtin__.object)
`` |  | Methods defined here: Create(self, finder_options) IsRemote(self) SetCredentialsPath(self, _) __init__(self) Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` platform `The platform object from the returned browser. To change this or set it up, change the returned browser's platform.` returned_browser `The browser object that will be returned through later API calls.`
class FakeSharedPageState(telemetry.page.shared_page_state.SharedPageState)
`` |  | Method resolution order: FakeSharedPageState telemetry.page.shared_page_state.SharedPageState telemetry.story.shared_state.SharedState __builtin__.object Methods defined here: ConfigurePossibleBrowser(self, possible_browser) `Override this to configure the PossibleBrowser. Can make changes to the browser's configuration here via e.g.: possible_browser.returned_browser.returned_system_info = ...` DidRunStory(self, results) __init__(self, test, finder_options, story_set) Methods inherited from telemetry.page.shared_page_state.SharedPageState: CanRunOnBrowser(self, browser_info, page) `Override this to return whether the browser brought up by this state instance is suitable for running the given page. Args: browser_info: an instance of telemetry.core.browser_info.BrowserInfo page: an instance of telemetry.page.Page` CanRunStory(self, page) GetPregeneratedProfileArchiveDir(self) RunStory(self, results) SetPregeneratedProfileArchiveDir(self, archive_path) `Benchmarks can set a pre-generated profile archive to indicate that when Chrome is launched, it should have a --user-data-dir set to the pregenerated profile, rather than to an empty profile. If the benchmark is invoked with the option --profile-dir=<dir>, that option overrides this value.` TearDownState(self) WillRunStory(self, page) Data descriptors inherited from telemetry.page.shared_page_state.SharedPageState: browser current_page current_tab page_test platform Data descriptors inherited from telemetry.story.shared_state.SharedState: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class FakeSystemInfo(telemetry.internal.platform.system_info.SystemInfo)
`` |  | Method resolution order: FakeSystemInfo telemetry.internal.platform.system_info.SystemInfo __builtin__.object Methods defined here: __init__(self, model_name='', gpu_dict=None) Class methods inherited from telemetry.internal.platform.system_info.SystemInfo: FromDict(cls, attrs) from __builtin__.type `Constructs a SystemInfo from a dictionary of attributes. Attributes currently required to be present in the dictionary: model_name (string): a platform-dependent string describing the model of machine, or the empty string if not supported. gpu (object containing GPUInfo's required attributes)` Data descriptors inherited from telemetry.internal.platform.system_info.SystemInfo: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` gpu `A GPUInfo object describing the graphics processor(s) on the system.` model_name `A string describing the machine model. This is a highly platform-dependent value and not currently specified for any machine type aside from Macs. On Mac OS, this is the model identifier, reformatted slightly; for example, 'MacBookPro 10.1'.`

Functions
`` |  | CreateBrowserFinderOptions(browser_type=None) `Creates fake browser finder options for discovering a browser.`