Home | History | Annotate | Download | only in pydoc
      1 
      2 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
      3 <html><head><title>Python: module telemetry.page.page_test</title>
      4 <meta charset="utf-8">
      5 </head><body bgcolor="#f0f0f8">
      6 
      7 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
      8 <tr bgcolor="#7799ee">
      9 <td valign=bottom>&nbsp;<br>
     10 <font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="telemetry.html"><font color="#ffffff">telemetry</font></a>.<a href="telemetry.page.html"><font color="#ffffff">page</font></a>.page_test</strong></big></big></font></td
     11 ><td align=right valign=bottom
     12 ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="../telemetry/page/page_test.py">telemetry/page/page_test.py</a></font></td></tr></table>
     13     <p><tt>#&nbsp;Copyright&nbsp;2012&nbsp;The&nbsp;Chromium&nbsp;Authors.&nbsp;All&nbsp;rights&nbsp;reserved.<br>
     14 #&nbsp;Use&nbsp;of&nbsp;this&nbsp;source&nbsp;code&nbsp;is&nbsp;governed&nbsp;by&nbsp;a&nbsp;BSD-style&nbsp;license&nbsp;that&nbsp;can&nbsp;be<br>
     15 #&nbsp;found&nbsp;in&nbsp;the&nbsp;LICENSE&nbsp;file.</tt></p>
     16 <p>
     17 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
     18 <tr bgcolor="#aa55cc">
     19 <td colspan=3 valign=bottom>&nbsp;<br>
     20 <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
     21     
     22 <tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
     23 <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="telemetry.page.action_runner.html">telemetry.page.action_runner</a><br>
     24 </td><td width="25%" valign=top><a href="telemetry.core.exceptions.html">telemetry.core.exceptions</a><br>
     25 </td><td width="25%" valign=top><a href="logging.html">logging</a><br>
     26 </td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
     27 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
     28 <tr bgcolor="#ee77aa">
     29 <td colspan=3 valign=bottom>&nbsp;<br>
     30 <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
     31     
     32 <tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
     33 <td width="100%"><dl>
     34 <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
     35 </font></dt><dd>
     36 <dl>
     37 <dt><font face="helvetica, arial"><a href="telemetry.page.page_test.html#PageTest">PageTest</a>
     38 </font></dt></dl>
     39 </dd>
     40 <dt><font face="helvetica, arial"><a href="exceptions.html#Exception">exceptions.Exception</a>(<a href="exceptions.html#BaseException">exceptions.BaseException</a>)
     41 </font></dt><dd>
     42 <dl>
     43 <dt><font face="helvetica, arial"><a href="telemetry.page.page_test.html#MultiTabTestAppCrashError">MultiTabTestAppCrashError</a>
     44 </font></dt><dt><font face="helvetica, arial"><a href="telemetry.page.page_test.html#TestNotSupportedOnPlatformError">TestNotSupportedOnPlatformError</a>
     45 </font></dt></dl>
     46 </dd>
     47 <dt><font face="helvetica, arial"><a href="telemetry.web_perf.story_test.html#Failure">telemetry.web_perf.story_test.Failure</a>(<a href="exceptions.html#Exception">exceptions.Exception</a>)
     48 </font></dt><dd>
     49 <dl>
     50 <dt><font face="helvetica, arial"><a href="telemetry.page.page_test.html#MeasurementFailure">MeasurementFailure</a>
     51 </font></dt></dl>
     52 </dd>
     53 </dl>
     54  <p>
     55 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
     56 <tr bgcolor="#ffc8d8">
     57 <td colspan=3 valign=bottom>&nbsp;<br>
     58 <font color="#000000" face="helvetica, arial"><a name="MeasurementFailure">class <strong>MeasurementFailure</strong></a>(<a href="telemetry.web_perf.story_test.html#Failure">telemetry.web_perf.story_test.Failure</a>)</font></td></tr>
     59     
     60 <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
     61 <td colspan=2><tt><a href="#PageTest">PageTest</a>&nbsp;<a href="exceptions.html#Exception">Exception</a>&nbsp;raised&nbsp;when&nbsp;an&nbsp;undesired&nbsp;but&nbsp;designed-for&nbsp;problem.<br>&nbsp;</tt></td></tr>
     62 <tr><td>&nbsp;</td>
     63 <td width="100%"><dl><dt>Method resolution order:</dt>
     64 <dd><a href="telemetry.page.page_test.html#MeasurementFailure">MeasurementFailure</a></dd>
     65 <dd><a href="telemetry.web_perf.story_test.html#Failure">telemetry.web_perf.story_test.Failure</a></dd>
     66 <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd>
     67 <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd>
     68 <dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
     69 </dl>
     70 <hr>
     71 Data descriptors inherited from <a href="telemetry.web_perf.story_test.html#Failure">telemetry.web_perf.story_test.Failure</a>:<br>
     72 <dl><dt><strong>__weakref__</strong></dt>
     73 <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
     74 </dl>
     75 <hr>
     76 Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
     77 <dl><dt><a name="MeasurementFailure-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#MeasurementFailure-__init__">__init__</a>(...)&nbsp;initializes&nbsp;x;&nbsp;see&nbsp;help(type(x))&nbsp;for&nbsp;signature</tt></dd></dl>
     78 
     79 <hr>
     80 Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
     81 <dl><dt><strong>__new__</strong> = &lt;built-in method __new__ of type object&gt;<dd><tt>T.<a href="#MeasurementFailure-__new__">__new__</a>(S,&nbsp;...)&nbsp;-&gt;&nbsp;a&nbsp;new&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;with&nbsp;type&nbsp;S,&nbsp;a&nbsp;subtype&nbsp;of&nbsp;T</tt></dl>
     82 
     83 <hr>
     84 Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br>
     85 <dl><dt><a name="MeasurementFailure-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#MeasurementFailure-__delattr__">__delattr__</a>('name')&nbsp;&lt;==&gt;&nbsp;del&nbsp;x.name</tt></dd></dl>
     86 
     87 <dl><dt><a name="MeasurementFailure-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#MeasurementFailure-__getattribute__">__getattribute__</a>('name')&nbsp;&lt;==&gt;&nbsp;x.name</tt></dd></dl>
     88 
     89 <dl><dt><a name="MeasurementFailure-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#MeasurementFailure-__getitem__">__getitem__</a>(y)&nbsp;&lt;==&gt;&nbsp;x[y]</tt></dd></dl>
     90 
     91 <dl><dt><a name="MeasurementFailure-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#MeasurementFailure-__getslice__">__getslice__</a>(i,&nbsp;j)&nbsp;&lt;==&gt;&nbsp;x[i:j]<br>
     92 &nbsp;<br>
     93 Use&nbsp;of&nbsp;negative&nbsp;indices&nbsp;is&nbsp;not&nbsp;supported.</tt></dd></dl>
     94 
     95 <dl><dt><a name="MeasurementFailure-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl>
     96 
     97 <dl><dt><a name="MeasurementFailure-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#MeasurementFailure-__repr__">__repr__</a>()&nbsp;&lt;==&gt;&nbsp;repr(x)</tt></dd></dl>
     98 
     99 <dl><dt><a name="MeasurementFailure-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#MeasurementFailure-__setattr__">__setattr__</a>('name',&nbsp;value)&nbsp;&lt;==&gt;&nbsp;x.name&nbsp;=&nbsp;value</tt></dd></dl>
    100 
    101 <dl><dt><a name="MeasurementFailure-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl>
    102 
    103 <dl><dt><a name="MeasurementFailure-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#MeasurementFailure-__str__">__str__</a>()&nbsp;&lt;==&gt;&nbsp;str(x)</tt></dd></dl>
    104 
    105 <dl><dt><a name="MeasurementFailure-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl>
    106 
    107 <hr>
    108 Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br>
    109 <dl><dt><strong>__dict__</strong></dt>
    110 </dl>
    111 <dl><dt><strong>args</strong></dt>
    112 </dl>
    113 <dl><dt><strong>message</strong></dt>
    114 </dl>
    115 </td></tr></table> <p>
    116 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
    117 <tr bgcolor="#ffc8d8">
    118 <td colspan=3 valign=bottom>&nbsp;<br>
    119 <font color="#000000" face="helvetica, arial"><a name="MultiTabTestAppCrashError">class <strong>MultiTabTestAppCrashError</strong></a>(<a href="exceptions.html#Exception">exceptions.Exception</a>)</font></td></tr>
    120     
    121 <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
    122 <td colspan=2><tt><a href="#PageTest">PageTest</a>&nbsp;<a href="exceptions.html#Exception">Exception</a>&nbsp;raised&nbsp;after&nbsp;browser&nbsp;or&nbsp;tab&nbsp;crash&nbsp;for&nbsp;multi-tab&nbsp;tests.<br>
    123 &nbsp;<br>
    124 Used&nbsp;to&nbsp;abort&nbsp;the&nbsp;test&nbsp;rather&nbsp;than&nbsp;try&nbsp;to&nbsp;recover&nbsp;from&nbsp;an&nbsp;unknown&nbsp;state.<br>&nbsp;</tt></td></tr>
    125 <tr><td>&nbsp;</td>
    126 <td width="100%"><dl><dt>Method resolution order:</dt>
    127 <dd><a href="telemetry.page.page_test.html#MultiTabTestAppCrashError">MultiTabTestAppCrashError</a></dd>
    128 <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd>
    129 <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd>
    130 <dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
    131 </dl>
    132 <hr>
    133 Data descriptors defined here:<br>
    134 <dl><dt><strong>__weakref__</strong></dt>
    135 <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
    136 </dl>
    137 <hr>
    138 Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
    139 <dl><dt><a name="MultiTabTestAppCrashError-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#MultiTabTestAppCrashError-__init__">__init__</a>(...)&nbsp;initializes&nbsp;x;&nbsp;see&nbsp;help(type(x))&nbsp;for&nbsp;signature</tt></dd></dl>
    140 
    141 <hr>
    142 Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
    143 <dl><dt><strong>__new__</strong> = &lt;built-in method __new__ of type object&gt;<dd><tt>T.<a href="#MultiTabTestAppCrashError-__new__">__new__</a>(S,&nbsp;...)&nbsp;-&gt;&nbsp;a&nbsp;new&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;with&nbsp;type&nbsp;S,&nbsp;a&nbsp;subtype&nbsp;of&nbsp;T</tt></dl>
    144 
    145 <hr>
    146 Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br>
    147 <dl><dt><a name="MultiTabTestAppCrashError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#MultiTabTestAppCrashError-__delattr__">__delattr__</a>('name')&nbsp;&lt;==&gt;&nbsp;del&nbsp;x.name</tt></dd></dl>
    148 
    149 <dl><dt><a name="MultiTabTestAppCrashError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#MultiTabTestAppCrashError-__getattribute__">__getattribute__</a>('name')&nbsp;&lt;==&gt;&nbsp;x.name</tt></dd></dl>
    150 
    151 <dl><dt><a name="MultiTabTestAppCrashError-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#MultiTabTestAppCrashError-__getitem__">__getitem__</a>(y)&nbsp;&lt;==&gt;&nbsp;x[y]</tt></dd></dl>
    152 
    153 <dl><dt><a name="MultiTabTestAppCrashError-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#MultiTabTestAppCrashError-__getslice__">__getslice__</a>(i,&nbsp;j)&nbsp;&lt;==&gt;&nbsp;x[i:j]<br>
    154 &nbsp;<br>
    155 Use&nbsp;of&nbsp;negative&nbsp;indices&nbsp;is&nbsp;not&nbsp;supported.</tt></dd></dl>
    156 
    157 <dl><dt><a name="MultiTabTestAppCrashError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl>
    158 
    159 <dl><dt><a name="MultiTabTestAppCrashError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#MultiTabTestAppCrashError-__repr__">__repr__</a>()&nbsp;&lt;==&gt;&nbsp;repr(x)</tt></dd></dl>
    160 
    161 <dl><dt><a name="MultiTabTestAppCrashError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#MultiTabTestAppCrashError-__setattr__">__setattr__</a>('name',&nbsp;value)&nbsp;&lt;==&gt;&nbsp;x.name&nbsp;=&nbsp;value</tt></dd></dl>
    162 
    163 <dl><dt><a name="MultiTabTestAppCrashError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl>
    164 
    165 <dl><dt><a name="MultiTabTestAppCrashError-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#MultiTabTestAppCrashError-__str__">__str__</a>()&nbsp;&lt;==&gt;&nbsp;str(x)</tt></dd></dl>
    166 
    167 <dl><dt><a name="MultiTabTestAppCrashError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl>
    168 
    169 <hr>
    170 Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br>
    171 <dl><dt><strong>__dict__</strong></dt>
    172 </dl>
    173 <dl><dt><strong>args</strong></dt>
    174 </dl>
    175 <dl><dt><strong>message</strong></dt>
    176 </dl>
    177 </td></tr></table> <p>
    178 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
    179 <tr bgcolor="#ffc8d8">
    180 <td colspan=3 valign=bottom>&nbsp;<br>
    181 <font color="#000000" face="helvetica, arial"><a name="PageTest">class <strong>PageTest</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    182     
    183 <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
    184 <td colspan=2><tt>A&nbsp;class&nbsp;styled&nbsp;on&nbsp;unittest.TestCase&nbsp;for&nbsp;creating&nbsp;page-specific&nbsp;tests.<br>
    185 &nbsp;<br>
    186 Test&nbsp;should&nbsp;override&nbsp;ValidateAndMeasurePage&nbsp;to&nbsp;perform&nbsp;test<br>
    187 validation&nbsp;and&nbsp;page&nbsp;measurement&nbsp;as&nbsp;necessary.<br>
    188 &nbsp;<br>
    189 &nbsp;&nbsp;&nbsp;class&nbsp;BodyChildElementMeasurement(<a href="#PageTest">PageTest</a>):<br>
    190 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def&nbsp;<a href="#PageTest-ValidateAndMeasurePage">ValidateAndMeasurePage</a>(self,&nbsp;page,&nbsp;tab,&nbsp;results):<br>
    191 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;body_child_count&nbsp;=&nbsp;tab.EvaluateJavaScript(<br>
    192 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'document.body.children.length')<br>
    193 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;results.AddValue(scalar.ScalarValue(<br>
    194 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;page,&nbsp;'body_children',&nbsp;'count',&nbsp;body_child_count))<br>&nbsp;</tt></td></tr>
    195 <tr><td>&nbsp;</td>
    196 <td width="100%">Methods defined here:<br>
    197 <dl><dt><a name="PageTest-CustomizeBrowserOptions"><strong>CustomizeBrowserOptions</strong></a>(self, options)</dt><dd><tt>Override&nbsp;to&nbsp;add&nbsp;test-specific&nbsp;options&nbsp;to&nbsp;the&nbsp;BrowserOptions&nbsp;<a href="__builtin__.html#object">object</a></tt></dd></dl>
    198 
    199 <dl><dt><a name="PageTest-DidNavigateToPage"><strong>DidNavigateToPage</strong></a>(self, page, tab)</dt><dd><tt>Override&nbsp;to&nbsp;do&nbsp;operations&nbsp;right&nbsp;after&nbsp;the&nbsp;page&nbsp;is&nbsp;navigated&nbsp;and&nbsp;after<br>
    200 all&nbsp;waiting&nbsp;for&nbsp;completion&nbsp;has&nbsp;occurred.</tt></dd></dl>
    201 
    202 <dl><dt><a name="PageTest-DidRunPage"><strong>DidRunPage</strong></a>(self, platform)</dt><dd><tt>Called&nbsp;after&nbsp;the&nbsp;test&nbsp;run&nbsp;method&nbsp;was&nbsp;run,&nbsp;even&nbsp;if&nbsp;it&nbsp;failed.</tt></dd></dl>
    203 
    204 <dl><dt><a name="PageTest-DidStartBrowser"><strong>DidStartBrowser</strong></a>(self, browser)</dt><dd><tt>Override&nbsp;to&nbsp;customize&nbsp;the&nbsp;browser&nbsp;right&nbsp;after&nbsp;it&nbsp;has&nbsp;launched.</tt></dd></dl>
    205 
    206 <dl><dt><a name="PageTest-RestartBrowserBeforeEachPage"><strong>RestartBrowserBeforeEachPage</strong></a>(self)</dt><dd><tt>Should&nbsp;the&nbsp;browser&nbsp;be&nbsp;restarted&nbsp;for&nbsp;the&nbsp;page?<br>
    207 &nbsp;<br>
    208 This&nbsp;returns&nbsp;true&nbsp;if&nbsp;the&nbsp;test&nbsp;needs&nbsp;to&nbsp;unconditionally&nbsp;restart&nbsp;the<br>
    209 browser&nbsp;for&nbsp;each&nbsp;page.&nbsp;It&nbsp;may&nbsp;be&nbsp;called&nbsp;before&nbsp;the&nbsp;browser&nbsp;is&nbsp;started.</tt></dd></dl>
    210 
    211 <dl><dt><a name="PageTest-RunNavigateSteps"><strong>RunNavigateSteps</strong></a>(self, page, tab)</dt><dd><tt>Navigates&nbsp;the&nbsp;tab&nbsp;to&nbsp;the&nbsp;page&nbsp;URL&nbsp;attribute.<br>
    212 &nbsp;<br>
    213 Runs&nbsp;the&nbsp;'navigate_steps'&nbsp;page&nbsp;attribute&nbsp;as&nbsp;a&nbsp;compound&nbsp;action.</tt></dd></dl>
    214 
    215 <dl><dt><a name="PageTest-SetOptions"><strong>SetOptions</strong></a>(self, options)</dt><dd><tt>Sets&nbsp;the&nbsp;BrowserFinderOptions&nbsp;instance&nbsp;to&nbsp;use.</tt></dd></dl>
    216 
    217 <dl><dt><a name="PageTest-StopBrowserAfterPage"><strong>StopBrowserAfterPage</strong></a>(self, browser, page)</dt><dd><tt>Should&nbsp;the&nbsp;browser&nbsp;be&nbsp;stopped&nbsp;after&nbsp;the&nbsp;page&nbsp;is&nbsp;run?<br>
    218 &nbsp;<br>
    219 This&nbsp;is&nbsp;called&nbsp;after&nbsp;a&nbsp;page&nbsp;is&nbsp;run&nbsp;to&nbsp;decide&nbsp;whether&nbsp;the&nbsp;browser&nbsp;needs&nbsp;to<br>
    220 be&nbsp;stopped&nbsp;to&nbsp;clean&nbsp;up&nbsp;its&nbsp;state.&nbsp;If&nbsp;it&nbsp;is&nbsp;stopped,&nbsp;then&nbsp;it&nbsp;will&nbsp;be<br>
    221 restarted&nbsp;to&nbsp;run&nbsp;the&nbsp;next&nbsp;page.<br>
    222 &nbsp;<br>
    223 A&nbsp;test&nbsp;that&nbsp;overrides&nbsp;this&nbsp;can&nbsp;look&nbsp;at&nbsp;both&nbsp;the&nbsp;page&nbsp;and&nbsp;the&nbsp;browser&nbsp;to<br>
    224 decide&nbsp;whether&nbsp;it&nbsp;needs&nbsp;to&nbsp;stop&nbsp;the&nbsp;browser.</tt></dd></dl>
    225 
    226 <dl><dt><a name="PageTest-TabForPage"><strong>TabForPage</strong></a>(self, page, browser)</dt><dd><tt>Override&nbsp;to&nbsp;select&nbsp;a&nbsp;different&nbsp;tab&nbsp;for&nbsp;the&nbsp;page.&nbsp;&nbsp;For&nbsp;instance,&nbsp;to<br>
    227 create&nbsp;a&nbsp;new&nbsp;tab&nbsp;for&nbsp;every&nbsp;page,&nbsp;return&nbsp;browser.tabs.New().</tt></dd></dl>
    228 
    229 <dl><dt><a name="PageTest-ValidateAndMeasurePage"><strong>ValidateAndMeasurePage</strong></a>(self, page, tab, results)</dt><dd><tt>Override&nbsp;to&nbsp;check&nbsp;test&nbsp;assertions&nbsp;and&nbsp;perform&nbsp;measurement.<br>
    230 &nbsp;<br>
    231 When&nbsp;adding&nbsp;measurement&nbsp;results,&nbsp;call&nbsp;results.AddValue(...)&nbsp;for<br>
    232 each&nbsp;result.&nbsp;Raise&nbsp;an&nbsp;exception&nbsp;or&nbsp;add&nbsp;a&nbsp;failure.FailureValue&nbsp;on<br>
    233 failure.&nbsp;page_test.py&nbsp;also&nbsp;provides&nbsp;several&nbsp;base&nbsp;exception&nbsp;classes<br>
    234 to&nbsp;use.<br>
    235 &nbsp;<br>
    236 Prefer&nbsp;metric&nbsp;value&nbsp;names&nbsp;that&nbsp;are&nbsp;in&nbsp;accordance&nbsp;with&nbsp;python<br>
    237 variable&nbsp;style.&nbsp;e.g.,&nbsp;metric_name.&nbsp;The&nbsp;name&nbsp;'url'&nbsp;must&nbsp;not&nbsp;be&nbsp;used.<br>
    238 &nbsp;<br>
    239 Put&nbsp;together:<br>
    240 &nbsp;&nbsp;def&nbsp;<a href="#PageTest-ValidateAndMeasurePage">ValidateAndMeasurePage</a>(self,&nbsp;page,&nbsp;tab,&nbsp;results):<br>
    241 &nbsp;&nbsp;&nbsp;&nbsp;res&nbsp;=&nbsp;tab.EvaluateJavaScript('2+2')<br>
    242 &nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;res&nbsp;!=&nbsp;4:<br>
    243 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raise&nbsp;<a href="exceptions.html#Exception">Exception</a>('Oh,&nbsp;wow.')<br>
    244 &nbsp;&nbsp;&nbsp;&nbsp;results.AddValue(scalar.ScalarValue(<br>
    245 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;page,&nbsp;'two_plus_two',&nbsp;'count',&nbsp;res))<br>
    246 &nbsp;<br>
    247 Args:<br>
    248 &nbsp;&nbsp;page:&nbsp;A&nbsp;telemetry.page.Page&nbsp;instance.<br>
    249 &nbsp;&nbsp;tab:&nbsp;A&nbsp;telemetry.core.Tab&nbsp;instance.<br>
    250 &nbsp;&nbsp;results:&nbsp;A&nbsp;telemetry.results.PageTestResults&nbsp;instance.</tt></dd></dl>
    251 
    252 <dl><dt><a name="PageTest-WillNavigateToPage"><strong>WillNavigateToPage</strong></a>(self, page, tab)</dt><dd><tt>Override&nbsp;to&nbsp;do&nbsp;operations&nbsp;before&nbsp;the&nbsp;page&nbsp;is&nbsp;navigated,&nbsp;notably&nbsp;Telemetry<br>
    253 will&nbsp;already&nbsp;have&nbsp;performed&nbsp;the&nbsp;following&nbsp;operations&nbsp;on&nbsp;the&nbsp;browser&nbsp;before<br>
    254 calling&nbsp;this&nbsp;function:<br>
    255 *&nbsp;Ensure&nbsp;only&nbsp;one&nbsp;tab&nbsp;is&nbsp;open.<br>
    256 *&nbsp;Call&nbsp;WaitForDocumentReadyStateToComplete&nbsp;on&nbsp;the&nbsp;tab.</tt></dd></dl>
    257 
    258 <dl><dt><a name="PageTest-WillStartBrowser"><strong>WillStartBrowser</strong></a>(self, platform)</dt><dd><tt>Override&nbsp;to&nbsp;manipulate&nbsp;the&nbsp;browser&nbsp;environment&nbsp;before&nbsp;it&nbsp;launches.</tt></dd></dl>
    259 
    260 <dl><dt><a name="PageTest-__init__"><strong>__init__</strong></a>(self, needs_browser_restart_after_each_page<font color="#909090">=False</font>, clear_cache_before_each_run<font color="#909090">=False</font>)</dt></dl>
    261 
    262 <hr>
    263 Data descriptors defined here:<br>
    264 <dl><dt><strong>__dict__</strong></dt>
    265 <dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
    266 </dl>
    267 <dl><dt><strong>__weakref__</strong></dt>
    268 <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
    269 </dl>
    270 <dl><dt><strong>clear_cache_before_each_run</strong></dt>
    271 <dd><tt>When&nbsp;set&nbsp;to&nbsp;True,&nbsp;the&nbsp;browser's&nbsp;disk&nbsp;and&nbsp;memory&nbsp;cache&nbsp;will&nbsp;be&nbsp;cleared<br>
    272 before&nbsp;each&nbsp;run.</tt></dd>
    273 </dl>
    274 <dl><dt><strong>close_tabs_before_run</strong></dt>
    275 <dd><tt>When&nbsp;set&nbsp;to&nbsp;True,&nbsp;all&nbsp;tabs&nbsp;are&nbsp;closed&nbsp;before&nbsp;running&nbsp;the&nbsp;test&nbsp;for&nbsp;the<br>
    276 first&nbsp;time.</tt></dd>
    277 </dl>
    278 <dl><dt><strong>is_multi_tab_test</strong></dt>
    279 <dd><tt>Returns&nbsp;True&nbsp;if&nbsp;the&nbsp;test&nbsp;opens&nbsp;multiple&nbsp;tabs.<br>
    280 &nbsp;<br>
    281 If&nbsp;the&nbsp;test&nbsp;overrides&nbsp;TabForPage,&nbsp;it&nbsp;is&nbsp;deemed&nbsp;a&nbsp;multi-tab&nbsp;test.<br>
    282 Multi-tab&nbsp;tests&nbsp;do&nbsp;not&nbsp;retry&nbsp;after&nbsp;tab&nbsp;or&nbsp;browser&nbsp;crashes,&nbsp;whereas,<br>
    283 single-tab&nbsp;tests&nbsp;too.&nbsp;That&nbsp;is&nbsp;because&nbsp;the&nbsp;state&nbsp;of&nbsp;multi-tab&nbsp;tests<br>
    284 (e.g.,&nbsp;how&nbsp;many&nbsp;tabs&nbsp;are&nbsp;open,&nbsp;etc.)&nbsp;is&nbsp;unknown&nbsp;after&nbsp;crashes.</tt></dd>
    285 </dl>
    286 </td></tr></table> <p>
    287 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
    288 <tr bgcolor="#ffc8d8">
    289 <td colspan=3 valign=bottom>&nbsp;<br>
    290 <font color="#000000" face="helvetica, arial"><a name="TestNotSupportedOnPlatformError">class <strong>TestNotSupportedOnPlatformError</strong></a>(<a href="exceptions.html#Exception">exceptions.Exception</a>)</font></td></tr>
    291     
    292 <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
    293 <td colspan=2><tt><a href="#PageTest">PageTest</a>&nbsp;<a href="exceptions.html#Exception">Exception</a>&nbsp;raised&nbsp;when&nbsp;a&nbsp;required&nbsp;feature&nbsp;is&nbsp;unavailable.<br>
    294 &nbsp;<br>
    295 The&nbsp;feature&nbsp;required&nbsp;to&nbsp;run&nbsp;the&nbsp;test&nbsp;could&nbsp;be&nbsp;part&nbsp;of&nbsp;the&nbsp;platform,<br>
    296 hardware&nbsp;configuration,&nbsp;or&nbsp;browser.<br>&nbsp;</tt></td></tr>
    297 <tr><td>&nbsp;</td>
    298 <td width="100%"><dl><dt>Method resolution order:</dt>
    299 <dd><a href="telemetry.page.page_test.html#TestNotSupportedOnPlatformError">TestNotSupportedOnPlatformError</a></dd>
    300 <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd>
    301 <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd>
    302 <dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
    303 </dl>
    304 <hr>
    305 Data descriptors defined here:<br>
    306 <dl><dt><strong>__weakref__</strong></dt>
    307 <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
    308 </dl>
    309 <hr>
    310 Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
    311 <dl><dt><a name="TestNotSupportedOnPlatformError-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#TestNotSupportedOnPlatformError-__init__">__init__</a>(...)&nbsp;initializes&nbsp;x;&nbsp;see&nbsp;help(type(x))&nbsp;for&nbsp;signature</tt></dd></dl>
    312 
    313 <hr>
    314 Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
    315 <dl><dt><strong>__new__</strong> = &lt;built-in method __new__ of type object&gt;<dd><tt>T.<a href="#TestNotSupportedOnPlatformError-__new__">__new__</a>(S,&nbsp;...)&nbsp;-&gt;&nbsp;a&nbsp;new&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;with&nbsp;type&nbsp;S,&nbsp;a&nbsp;subtype&nbsp;of&nbsp;T</tt></dl>
    316 
    317 <hr>
    318 Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br>
    319 <dl><dt><a name="TestNotSupportedOnPlatformError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#TestNotSupportedOnPlatformError-__delattr__">__delattr__</a>('name')&nbsp;&lt;==&gt;&nbsp;del&nbsp;x.name</tt></dd></dl>
    320 
    321 <dl><dt><a name="TestNotSupportedOnPlatformError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#TestNotSupportedOnPlatformError-__getattribute__">__getattribute__</a>('name')&nbsp;&lt;==&gt;&nbsp;x.name</tt></dd></dl>
    322 
    323 <dl><dt><a name="TestNotSupportedOnPlatformError-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#TestNotSupportedOnPlatformError-__getitem__">__getitem__</a>(y)&nbsp;&lt;==&gt;&nbsp;x[y]</tt></dd></dl>
    324 
    325 <dl><dt><a name="TestNotSupportedOnPlatformError-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#TestNotSupportedOnPlatformError-__getslice__">__getslice__</a>(i,&nbsp;j)&nbsp;&lt;==&gt;&nbsp;x[i:j]<br>
    326 &nbsp;<br>
    327 Use&nbsp;of&nbsp;negative&nbsp;indices&nbsp;is&nbsp;not&nbsp;supported.</tt></dd></dl>
    328 
    329 <dl><dt><a name="TestNotSupportedOnPlatformError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl>
    330 
    331 <dl><dt><a name="TestNotSupportedOnPlatformError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#TestNotSupportedOnPlatformError-__repr__">__repr__</a>()&nbsp;&lt;==&gt;&nbsp;repr(x)</tt></dd></dl>
    332 
    333 <dl><dt><a name="TestNotSupportedOnPlatformError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#TestNotSupportedOnPlatformError-__setattr__">__setattr__</a>('name',&nbsp;value)&nbsp;&lt;==&gt;&nbsp;x.name&nbsp;=&nbsp;value</tt></dd></dl>
    334 
    335 <dl><dt><a name="TestNotSupportedOnPlatformError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl>
    336 
    337 <dl><dt><a name="TestNotSupportedOnPlatformError-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#TestNotSupportedOnPlatformError-__str__">__str__</a>()&nbsp;&lt;==&gt;&nbsp;str(x)</tt></dd></dl>
    338 
    339 <dl><dt><a name="TestNotSupportedOnPlatformError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl>
    340 
    341 <hr>
    342 Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br>
    343 <dl><dt><strong>__dict__</strong></dt>
    344 </dl>
    345 <dl><dt><strong>args</strong></dt>
    346 </dl>
    347 <dl><dt><strong>message</strong></dt>
    348 </dl>
    349 </td></tr></table></td></tr></table>
    350 </body></html>