| Index: tools/chrome_proxy/webdriver/fallback.py
|
| diff --git a/tools/chrome_proxy/webdriver/fallback.py b/tools/chrome_proxy/webdriver/fallback.py
|
| index 4de3956fc74b4c67565be897fd2cefa3037c7827..86025e2b7243aeafd493a769e94985fa9adf042b 100644
|
| --- a/tools/chrome_proxy/webdriver/fallback.py
|
| +++ b/tools/chrome_proxy/webdriver/fallback.py
|
| @@ -36,5 +36,38 @@ class Fallback(IntegrationTest):
|
| self.assertHasChromeProxyViaHeader(response)
|
| self.assertEqual(u'http/1.1', response.protocol)
|
|
|
| + # Verify that when Chrome receives a non-4xx response through a Data Reduction
|
| + # Proxy that doesn't set a proper via header, Chrome falls back to the next
|
| + # available proxy.
|
| + def testMissingViaHeaderNon4xxFallback(self):
|
| + with TestDriver() as test_driver:
|
| + test_driver.AddChromeArg('--enable-spdy-proxy-auth')
|
| +
|
| + # Set the primary Data Reduction Proxy to be the test server, which does
|
| + # not add any Via headers. The fallback Data Reduction Proxy is set to the
|
| + # canonical Data Reduction Proxy target.
|
| + test_driver.AddChromeArg('--data-reduction-proxy-http-proxies='
|
| + 'https://chromeproxy-test.appspot.com;'
|
| + 'http://compress.googlezip.net')
|
| +
|
| + # Load a page that should fall back off of the test server proxy, and onto
|
| + # the canonical proxy that will set the correct Via header.
|
| + test_driver.LoadURL('http://chromeproxy-test.appspot.com/default')
|
| + responses = test_driver.GetHTTPResponses()
|
| + self.assertNotEqual(0, len(responses))
|
| + for response in responses:
|
| + self.assertHasChromeProxyViaHeader(response)
|
| + self.assertEqual(u'http/1.1', response.protocol)
|
| +
|
| + # Check that the BypassTypePrimary histogram has a single entry in the
|
| + # MissingViaHeaderOther category (which is enum value 5), to make sure
|
| + # that the bypass was caused by the missing via header logic and not
|
| + # something else.
|
| + histogram = test_driver.GetHistogram(
|
| + "DataReductionProxy.BypassTypePrimary")
|
| + self.assertEqual(1, histogram['count'])
|
| + self.assertIn({'count': 1, 'high': 6, 'low': 5}, histogram['buckets'])
|
| +
|
| +
|
| if __name__ == '__main__':
|
| IntegrationTest.RunAllTests()
|
|
|