Commit 852700db authored by Robert Ogden's avatar Robert Ogden Committed by Commit Bot

Add integration test for disabled bypass on missing via header

Also makes a small change to the GetWarmupURL() function in order to
allow this testing to work by preserving existing query params.

Cleans up a bit of whitespace in bypass.py

Bug: 724704
Change-Id: Ia84d1199911725684c00538f9ef651a427a9d279
Reviewed-on: https://chromium-review.googlesource.com/1024727
Commit-Queue: Robert Ogden <robertogden@chromium.org>
Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553187}
parent 782d0e07
......@@ -5,6 +5,7 @@
import common
from common import TestDriver
from common import IntegrationTest
from decorators import ChromeVersionEqualOrAfterM
class Bypass(IntegrationTest):
......@@ -102,6 +103,47 @@ class Bypass(IntegrationTest):
for response in responses:
self.assertHasChromeProxyViaHeader(response)
# Verify that Chrome does not bypass the proxy when a response gets a missing
# via header.
@ChromeVersionEqualOrAfterM(67)
def testMissingViaHeaderNoBypassExperiment(self):
with TestDriver() as t:
t.AddChromeArg('--enable-spdy-proxy-auth')
t.AddChromeArg('--enable-features=DataReductionProxyRobustConnection'
'<DataReductionProxyRobustConnection')
t.AddChromeArg('--force-fieldtrials=DataReductionProxyRobustConnection/'
'Enabled')
t.AddChromeArg('--force-fieldtrial-params='
'DataReductionProxyRobustConnection.Enabled:'
'warmup_fetch_callback_enabled/true/'
'bypass_missing_via_disabled/true')
t.AddChromeArg('--disable-data-reduction-proxy-warmup-url-fetch')
t.AddChromeArg('--data-reduction-proxy-http-proxies='
# The chromeproxy-test server is a simple HTTP server. If it is served a
# proxy-request, it will respond with a 404 error page. It will not set
# the Via header on the response.
'https://chromeproxy-test.appspot.com;http://compress.googlezip.net')
# Loading this URL should not hit the actual check.googlezip.net origin.
# Instead, the test server proxy should fully handle the request and will
# respond with an error page.
t.LoadURL("http://check.googlezip.net/test.html")
for response in t.GetHTTPResponses():
self.assertNotHasChromeProxyViaHeader(response)
# Check the via bypass histograms are empty.
histogram = t.GetHistogram(
'DataReductionProxy.BypassedBytes.MissingViaHeader4xx')
self.assertEqual(0, len(histogram))
histogram = t.GetHistogram(
'DataReductionProxy.BypassedBytes.MissingViaHeaderOther')
self.assertEqual(0, len(histogram))
# Check that the fetch used the proxy.
histogram = t.GetHistogram('DataReductionProxy.ProxySchemeUsed')
self.assertEqual(histogram['buckets'][0]['low'], 2)
self.assertEqual(histogram['buckets'][0]['high'], 3)
# Verify that when Chrome receives a 4xx response through a Data Reduction
# Proxy that doesn't set a proper via header, Chrome bypasses all proxies and
# retries the request over direct.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment