| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <html><head><title>Python: package telemetry.testing.fakes</title>
- <meta charset="utf-8">
- </head><body bgcolor="#f0f0f8">
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
- <tr bgcolor="#7799ee">
- <td valign=bottom> <br>
- <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="telemetry.html"><font color="#ffffff">telemetry</font></a>.<a href="telemetry.testing.html"><font color="#ffffff">testing</font></a>.fakes</strong></big></big></font></td
- ><td align=right valign=bottom
- ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="../telemetry/testing/fakes/__init__.py">telemetry/testing/fakes/__init__.py</a></font></td></tr></table>
- <p><tt>Provides fakes for several of Telemetry's internal objects.<br>
- <br>
- These allow code like story_runner and Benchmark to be run and tested<br>
- without compiling or starting a browser. Class names prepended with an<br>
- underscore are intended to be implementation details, and should not<br>
- be subclassed; however, some, like _FakeBrowser, have public APIs that<br>
- may need to be called in tests.</tt></p>
- <p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#aa55cc">
- <td colspan=3 valign=bottom> <br>
- <font color="#ffffff" face="helvetica, arial"><big><strong>Package Contents</strong></big></font></td></tr>
-
- <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
- <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#ee77aa">
- <td colspan=3 valign=bottom> <br>
- <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
-
- <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
- <td width="100%"><dl>
- <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
- </font></dt><dd>
- <dl>
- <dt><font face="helvetica, arial"><a href="telemetry.testing.fakes.html#FakeHTTPServer">FakeHTTPServer</a>
- </font></dt><dt><font face="helvetica, arial"><a href="telemetry.testing.fakes.html#FakeInspectorWebsocket">FakeInspectorWebsocket</a>
- </font></dt><dt><font face="helvetica, arial"><a href="telemetry.testing.fakes.html#FakePlatform">FakePlatform</a>
- </font></dt><dd>
- <dl>
- <dt><font face="helvetica, arial"><a href="telemetry.testing.fakes.html#FakeLinuxPlatform">FakeLinuxPlatform</a>
- </font></dt></dl>
- </dd>
- <dt><font face="helvetica, arial"><a href="telemetry.testing.fakes.html#FakePossibleBrowser">FakePossibleBrowser</a>
- </font></dt></dl>
- </dd>
- <dt><font face="helvetica, arial"><a href="telemetry.internal.platform.system_info.html#SystemInfo">telemetry.internal.platform.system_info.SystemInfo</a>(<a href="__builtin__.html#object">__builtin__.object</a>)
- </font></dt><dd>
- <dl>
- <dt><font face="helvetica, arial"><a href="telemetry.testing.fakes.html#FakeSystemInfo">FakeSystemInfo</a>
- </font></dt></dl>
- </dd>
- <dt><font face="helvetica, arial"><a href="telemetry.page.shared_page_state.html#SharedPageState">telemetry.page.shared_page_state.SharedPageState</a>(<a href="telemetry.story.shared_state.html#SharedState">telemetry.story.shared_state.SharedState</a>)
- </font></dt><dd>
- <dl>
- <dt><font face="helvetica, arial"><a href="telemetry.testing.fakes.html#FakeSharedPageState">FakeSharedPageState</a>
- </font></dt></dl>
- </dd>
- </dl>
- <p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#ffc8d8">
- <td colspan=3 valign=bottom> <br>
- <font color="#000000" face="helvetica, arial"><a name="FakeHTTPServer">class <strong>FakeHTTPServer</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
-
- <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
- <td width="100%">Methods defined here:<br>
- <dl><dt><a name="FakeHTTPServer-UrlOf"><strong>UrlOf</strong></a>(self, url)</dt></dl>
- <hr>
- Data descriptors defined here:<br>
- <dl><dt><strong>__dict__</strong></dt>
- <dd><tt>dictionary for instance variables (if defined)</tt></dd>
- </dl>
- <dl><dt><strong>__weakref__</strong></dt>
- <dd><tt>list of weak references to the object (if defined)</tt></dd>
- </dl>
- </td></tr></table> <p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#ffc8d8">
- <td colspan=3 valign=bottom> <br>
- <font color="#000000" face="helvetica, arial"><a name="FakeInspectorWebsocket">class <strong>FakeInspectorWebsocket</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
-
- <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
- <td width="100%">Methods defined here:<br>
- <dl><dt><a name="FakeInspectorWebsocket-AddAsyncResponse"><strong>AddAsyncResponse</strong></a>(self, method, result, time)</dt></dl>
- <dl><dt><a name="FakeInspectorWebsocket-AddEvent"><strong>AddEvent</strong></a>(self, method, params, time)</dt></dl>
- <dl><dt><a name="FakeInspectorWebsocket-AddResponseHandler"><strong>AddResponseHandler</strong></a>(self, method, handler)</dt></dl>
- <dl><dt><a name="FakeInspectorWebsocket-AsyncRequest"><strong>AsyncRequest</strong></a>(self, request, callback)</dt></dl>
- <dl><dt><a name="FakeInspectorWebsocket-Connect"><strong>Connect</strong></a>(self, _)</dt></dl>
- <dl><dt><a name="FakeInspectorWebsocket-DispatchNotifications"><strong>DispatchNotifications</strong></a>(self, timeout)</dt></dl>
- <dl><dt><a name="FakeInspectorWebsocket-RegisterDomain"><strong>RegisterDomain</strong></a>(self, _, handler)</dt></dl>
- <dl><dt><a name="FakeInspectorWebsocket-SendAndIgnoreResponse"><strong>SendAndIgnoreResponse</strong></a>(self, request)</dt></dl>
- <dl><dt><a name="FakeInspectorWebsocket-SyncRequest"><strong>SyncRequest</strong></a>(self, request, *_args, **_kwargs)</dt></dl>
- <dl><dt><a name="FakeInspectorWebsocket-__init__"><strong>__init__</strong></a>(self, mock_timer)</dt></dl>
- <hr>
- Data descriptors defined here:<br>
- <dl><dt><strong>__dict__</strong></dt>
- <dd><tt>dictionary for instance variables (if defined)</tt></dd>
- </dl>
- <dl><dt><strong>__weakref__</strong></dt>
- <dd><tt>list of weak references to the object (if defined)</tt></dd>
- </dl>
- </td></tr></table> <p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#ffc8d8">
- <td colspan=3 valign=bottom> <br>
- <font color="#000000" face="helvetica, arial"><a name="FakeLinuxPlatform">class <strong>FakeLinuxPlatform</strong></a>(<a href="telemetry.testing.fakes.html#FakePlatform">FakePlatform</a>)</font></td></tr>
-
- <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
- <td width="100%"><dl><dt>Method resolution order:</dt>
- <dd><a href="telemetry.testing.fakes.html#FakeLinuxPlatform">FakeLinuxPlatform</a></dd>
- <dd><a href="telemetry.testing.fakes.html#FakePlatform">FakePlatform</a></dd>
- <dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
- </dl>
- <hr>
- Methods defined here:<br>
- <dl><dt><a name="FakeLinuxPlatform-CanTakeScreenshot"><strong>CanTakeScreenshot</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakeLinuxPlatform-GetArchName"><strong>GetArchName</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakeLinuxPlatform-GetDeviceTypeName"><strong>GetDeviceTypeName</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakeLinuxPlatform-GetOSName"><strong>GetOSName</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakeLinuxPlatform-GetOSVersionName"><strong>GetOSVersionName</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakeLinuxPlatform-SetHTTPServerDirectories"><strong>SetHTTPServerDirectories</strong></a>(self, paths)</dt></dl>
- <dl><dt><a name="FakeLinuxPlatform-TakeScreenshot"><strong>TakeScreenshot</strong></a>(self, file_path)</dt></dl>
- <dl><dt><a name="FakeLinuxPlatform-__init__"><strong>__init__</strong></a>(self)</dt></dl>
- <hr>
- Data descriptors defined here:<br>
- <dl><dt><strong>is_host_platform</strong></dt>
- </dl>
- <hr>
- Methods inherited from <a href="telemetry.testing.fakes.html#FakePlatform">FakePlatform</a>:<br>
- <dl><dt><a name="FakeLinuxPlatform-CanMonitorThermalThrottling"><strong>CanMonitorThermalThrottling</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakeLinuxPlatform-HasBeenThermallyThrottled"><strong>HasBeenThermallyThrottled</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakeLinuxPlatform-IsThermallyThrottled"><strong>IsThermallyThrottled</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakeLinuxPlatform-StopAllLocalServers"><strong>StopAllLocalServers</strong></a>(self)</dt></dl>
- <hr>
- Data descriptors inherited from <a href="telemetry.testing.fakes.html#FakePlatform">FakePlatform</a>:<br>
- <dl><dt><strong>__dict__</strong></dt>
- <dd><tt>dictionary for instance variables (if defined)</tt></dd>
- </dl>
- <dl><dt><strong>__weakref__</strong></dt>
- <dd><tt>list of weak references to the object (if defined)</tt></dd>
- </dl>
- <dl><dt><strong>network_controller</strong></dt>
- </dl>
- <dl><dt><strong>tracing_controller</strong></dt>
- </dl>
- </td></tr></table> <p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#ffc8d8">
- <td colspan=3 valign=bottom> <br>
- <font color="#000000" face="helvetica, arial"><a name="FakePlatform">class <strong>FakePlatform</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
-
- <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
- <td width="100%">Methods defined here:<br>
- <dl><dt><a name="FakePlatform-CanMonitorThermalThrottling"><strong>CanMonitorThermalThrottling</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakePlatform-GetArchName"><strong>GetArchName</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakePlatform-GetDeviceTypeName"><strong>GetDeviceTypeName</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakePlatform-GetOSName"><strong>GetOSName</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakePlatform-GetOSVersionName"><strong>GetOSVersionName</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakePlatform-HasBeenThermallyThrottled"><strong>HasBeenThermallyThrottled</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakePlatform-IsThermallyThrottled"><strong>IsThermallyThrottled</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakePlatform-StopAllLocalServers"><strong>StopAllLocalServers</strong></a>(self)</dt></dl>
- <hr>
- Data descriptors defined here:<br>
- <dl><dt><strong>__dict__</strong></dt>
- <dd><tt>dictionary for instance variables (if defined)</tt></dd>
- </dl>
- <dl><dt><strong>__weakref__</strong></dt>
- <dd><tt>list of weak references to the object (if defined)</tt></dd>
- </dl>
- <dl><dt><strong>is_host_platform</strong></dt>
- </dl>
- <dl><dt><strong>network_controller</strong></dt>
- </dl>
- <dl><dt><strong>tracing_controller</strong></dt>
- </dl>
- </td></tr></table> <p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#ffc8d8">
- <td colspan=3 valign=bottom> <br>
- <font color="#000000" face="helvetica, arial"><a name="FakePossibleBrowser">class <strong>FakePossibleBrowser</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
-
- <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
- <td width="100%">Methods defined here:<br>
- <dl><dt><a name="FakePossibleBrowser-Create"><strong>Create</strong></a>(self, finder_options)</dt></dl>
- <dl><dt><a name="FakePossibleBrowser-IsRemote"><strong>IsRemote</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakePossibleBrowser-SetCredentialsPath"><strong>SetCredentialsPath</strong></a>(self, _)</dt></dl>
- <dl><dt><a name="FakePossibleBrowser-__init__"><strong>__init__</strong></a>(self)</dt></dl>
- <hr>
- Data descriptors defined here:<br>
- <dl><dt><strong>__dict__</strong></dt>
- <dd><tt>dictionary for instance variables (if defined)</tt></dd>
- </dl>
- <dl><dt><strong>__weakref__</strong></dt>
- <dd><tt>list of weak references to the object (if defined)</tt></dd>
- </dl>
- <dl><dt><strong>platform</strong></dt>
- <dd><tt>The platform object from the returned browser.<br>
- <br>
- To change this or set it up, change the returned browser's<br>
- platform.</tt></dd>
- </dl>
- <dl><dt><strong>returned_browser</strong></dt>
- <dd><tt>The browser object that will be returned through later API calls.</tt></dd>
- </dl>
- </td></tr></table> <p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#ffc8d8">
- <td colspan=3 valign=bottom> <br>
- <font color="#000000" face="helvetica, arial"><a name="FakeSharedPageState">class <strong>FakeSharedPageState</strong></a>(<a href="telemetry.page.shared_page_state.html#SharedPageState">telemetry.page.shared_page_state.SharedPageState</a>)</font></td></tr>
-
- <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
- <td width="100%"><dl><dt>Method resolution order:</dt>
- <dd><a href="telemetry.testing.fakes.html#FakeSharedPageState">FakeSharedPageState</a></dd>
- <dd><a href="telemetry.page.shared_page_state.html#SharedPageState">telemetry.page.shared_page_state.SharedPageState</a></dd>
- <dd><a href="telemetry.story.shared_state.html#SharedState">telemetry.story.shared_state.SharedState</a></dd>
- <dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
- </dl>
- <hr>
- Methods defined here:<br>
- <dl><dt><a name="FakeSharedPageState-ConfigurePossibleBrowser"><strong>ConfigurePossibleBrowser</strong></a>(self, possible_browser)</dt><dd><tt>Override this to configure the PossibleBrowser.<br>
- <br>
- Can make changes to the browser's configuration here via e.g.:<br>
- possible_browser.returned_browser.returned_system_info = ...</tt></dd></dl>
- <dl><dt><a name="FakeSharedPageState-DidRunStory"><strong>DidRunStory</strong></a>(self, results)</dt></dl>
- <dl><dt><a name="FakeSharedPageState-__init__"><strong>__init__</strong></a>(self, test, finder_options, story_set)</dt></dl>
- <hr>
- Methods inherited from <a href="telemetry.page.shared_page_state.html#SharedPageState">telemetry.page.shared_page_state.SharedPageState</a>:<br>
- <dl><dt><a name="FakeSharedPageState-CanRunOnBrowser"><strong>CanRunOnBrowser</strong></a>(self, browser_info, page)</dt><dd><tt>Override this to return whether the browser brought up by this state<br>
- instance is suitable for running the given page.<br>
- <br>
- Args:<br>
- browser_info: an instance of telemetry.core.browser_info.BrowserInfo<br>
- page: an instance of telemetry.page.Page</tt></dd></dl>
- <dl><dt><a name="FakeSharedPageState-CanRunStory"><strong>CanRunStory</strong></a>(self, page)</dt></dl>
- <dl><dt><a name="FakeSharedPageState-GetPregeneratedProfileArchiveDir"><strong>GetPregeneratedProfileArchiveDir</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakeSharedPageState-RunStory"><strong>RunStory</strong></a>(self, results)</dt></dl>
- <dl><dt><a name="FakeSharedPageState-SetPregeneratedProfileArchiveDir"><strong>SetPregeneratedProfileArchiveDir</strong></a>(self, archive_path)</dt><dd><tt>Benchmarks can set a pre-generated profile archive to indicate that when<br>
- Chrome is launched, it should have a --user-data-dir set to the<br>
- pregenerated profile, rather than to an empty profile.<br>
- <br>
- If the benchmark is invoked with the option --profile-dir=<dir>, that<br>
- option overrides this value.</tt></dd></dl>
- <dl><dt><a name="FakeSharedPageState-TearDownState"><strong>TearDownState</strong></a>(self)</dt></dl>
- <dl><dt><a name="FakeSharedPageState-WillRunStory"><strong>WillRunStory</strong></a>(self, page)</dt></dl>
- <hr>
- Data descriptors inherited from <a href="telemetry.page.shared_page_state.html#SharedPageState">telemetry.page.shared_page_state.SharedPageState</a>:<br>
- <dl><dt><strong>browser</strong></dt>
- </dl>
- <dl><dt><strong>current_page</strong></dt>
- </dl>
- <dl><dt><strong>current_tab</strong></dt>
- </dl>
- <dl><dt><strong>page_test</strong></dt>
- </dl>
- <dl><dt><strong>platform</strong></dt>
- </dl>
- <hr>
- Data descriptors inherited from <a href="telemetry.story.shared_state.html#SharedState">telemetry.story.shared_state.SharedState</a>:<br>
- <dl><dt><strong>__dict__</strong></dt>
- <dd><tt>dictionary for instance variables (if defined)</tt></dd>
- </dl>
- <dl><dt><strong>__weakref__</strong></dt>
- <dd><tt>list of weak references to the object (if defined)</tt></dd>
- </dl>
- </td></tr></table> <p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#ffc8d8">
- <td colspan=3 valign=bottom> <br>
- <font color="#000000" face="helvetica, arial"><a name="FakeSystemInfo">class <strong>FakeSystemInfo</strong></a>(<a href="telemetry.internal.platform.system_info.html#SystemInfo">telemetry.internal.platform.system_info.SystemInfo</a>)</font></td></tr>
-
- <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
- <td width="100%"><dl><dt>Method resolution order:</dt>
- <dd><a href="telemetry.testing.fakes.html#FakeSystemInfo">FakeSystemInfo</a></dd>
- <dd><a href="telemetry.internal.platform.system_info.html#SystemInfo">telemetry.internal.platform.system_info.SystemInfo</a></dd>
- <dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
- </dl>
- <hr>
- Methods defined here:<br>
- <dl><dt><a name="FakeSystemInfo-__init__"><strong>__init__</strong></a>(self, model_name<font color="#909090">=''</font>, gpu_dict<font color="#909090">=None</font>)</dt></dl>
- <hr>
- Class methods inherited from <a href="telemetry.internal.platform.system_info.html#SystemInfo">telemetry.internal.platform.system_info.SystemInfo</a>:<br>
- <dl><dt><a name="FakeSystemInfo-FromDict"><strong>FromDict</strong></a>(cls, attrs)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Constructs a <a href="telemetry.internal.platform.system_info.html#SystemInfo">SystemInfo</a> from a dictionary of attributes.<br>
- Attributes currently required to be present in the dictionary:<br>
- <br>
- model_name (string): a platform-dependent string<br>
- describing the model of machine, or the empty string if not<br>
- supported.<br>
- gpu (<a href="__builtin__.html#object">object</a> containing GPUInfo's required attributes)</tt></dd></dl>
- <hr>
- Data descriptors inherited from <a href="telemetry.internal.platform.system_info.html#SystemInfo">telemetry.internal.platform.system_info.SystemInfo</a>:<br>
- <dl><dt><strong>__dict__</strong></dt>
- <dd><tt>dictionary for instance variables (if defined)</tt></dd>
- </dl>
- <dl><dt><strong>__weakref__</strong></dt>
- <dd><tt>list of weak references to the object (if defined)</tt></dd>
- </dl>
- <dl><dt><strong>gpu</strong></dt>
- <dd><tt>A GPUInfo object describing the graphics processor(s) on the system.</tt></dd>
- </dl>
- <dl><dt><strong>model_name</strong></dt>
- <dd><tt>A string describing the machine model.<br>
- <br>
- This is a highly platform-dependent value and not currently<br>
- specified for any machine type aside from Macs. On Mac OS, this<br>
- is the model identifier, reformatted slightly; for example,<br>
- 'MacBookPro 10.1'.</tt></dd>
- </dl>
- </td></tr></table></td></tr></table><p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#eeaa77">
- <td colspan=3 valign=bottom> <br>
- <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
-
- <tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
- <td width="100%"><dl><dt><a name="-CreateBrowserFinderOptions"><strong>CreateBrowserFinderOptions</strong></a>(browser_type<font color="#909090">=None</font>)</dt><dd><tt>Creates fake browser finder options for discovering a browser.</tt></dd></dl>
- </td></tr></table>
- </body></html>
|