original_docstring: Wait until responses start coming back with the Chrome Proxy via header.
  
    Poll |url| in |tab| until the Chrome Proxy via header is present in a
    response.
  
    This function is useful when testing with the Data Saver API, since Chrome
    won't actually start sending requests to the Data Reduction Proxy until the
    Data Saver API fetch completes. This function can be used to wait for the Data
    Saver API fetch to complete.
    
docstring: Wait until responses start coming back with the Chrome Proxy via header.
  Poll |url| in |tab| until the Chrome Proxy via header is present in a
  response.
  
  This function is useful when testing with the Data Saver API, since Chrome
  won't actually start sending requests to the Data Reduction Proxy until the
  Data Saver API fetch completes. This function can be used to wait for the Data
  Saver API fetch to complete.
docstring_tokens: Wait until responses start coming back with the Chrome Proxy via header . Poll |url| in |tab| until the Chrome Proxy via header is present in a response . This function is useful when testing with the Data Saver API since Chrome won ' t actually start sending requests to the Data Reduction Proxy until the Data Saver API fetch completes . This function can be used to wait for the Data Saver API fetch to complete .
code: def WaitForViaHeader(tab, url="http://check.googlezip.net/test.html"):
    """Wait until responses start coming back with the Chrome Proxy via header.
  
    Poll |url| in |tab| until the Chrome Proxy via header is present in a
    response.
  
    This function is useful when testing with the Data Saver API, since Chrome
    won't actually start sending requests to the Data Reduction Proxy until the
    Data Saver API fetch completes. This function can be used to wait for the Data
    Saver API fetch to complete.
    """
  
    tab.Navigate('data:text/html;base64,%s' % base64.b64encode(
      '<html><body><script>'
      'function ProbeViaHeader(url, wanted_via) {'
        'var xmlhttp = new XMLHttpRequest();'
        'xmlhttp.open("HEAD",url,false);'
        'xmlhttp.send();'
        'var via=xmlhttp.getResponseHeader("via");'
        'return (via && via.indexOf(wanted_via) != -1);'
      '}'
      '</script>'
      'Waiting for Chrome to start using the DRP...'
      '</body></html>'))
  
    # Ensure the page has started loading before attempting the DRP check.
    tab.WaitForJavaScriptExpression('performance.timing.loadEventStart', 300)
    tab.WaitForJavaScriptExpression(
      'ProbeViaHeader("%s", "%s")' % (url, metrics.CHROME_PROXY_VIA_HEADER), 300)
code_tokens: def WaitForViaHeader ( tab , url = "http://check.googlezip.net/test.html" ) : tab . Navigate ( 'data:text/html;base64,%s' % base64 . b64encode ( '<html><body><script>' 'function ProbeViaHeader(url, wanted_via) {' 'var xmlhttp = new XMLHttpRequest();' 'xmlhttp.open("HEAD",url,false);' 'xmlhttp.send();' 'var via=xmlhttp.getResponseHeader("via");' 'return (via && via.indexOf(wanted_via) != -1);' '}' '</script>' 'Waiting for Chrome to start using the DRP...' '</body></html>' ) ) tab . WaitForJavaScriptExpression ( 'performance.timing.loadEventStart' , 300 ) tab . WaitForJavaScriptExpression ( 'ProbeViaHeader("%s", "%s")' % ( url , metrics . CHROME_PROXY_VIA_HEADER ) , 300 )
short_docstring: Wait until responses start coming back with the Chrome Proxy via header.
short_docstring_tokens: Wait until responses start coming back with the Chrome Proxy via header .
comment: """Wait until responses start coming back with the Chrome Proxy via header.
  
    Poll |url| in |tab| until the Chrome Proxy via header is present in a
    response.
  
    This function is useful when testing with the Data Saver API, since Chrome
    won't actually start sending requests to the Data Reduction Proxy until the
    Data Saver API fetch completes. This function can be used to wait for the Data
    Saver API fetch to complete.
    """$SEP$# Ensure the page has started loading before attempting the DRP check.