Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: tools/chrome_proxy/webdriver/bypass.py

Issue 2741263002: Added Data Saver ChromeDriver test for via header fallback logic. (Closed)
Patch Set: Remove 4xx test, and add remote port check Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2017 The Chromium Authors. All rights reserved. 1 # Copyright 2017 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import common 5 import common
6 from common import TestDriver 6 from common import TestDriver
7 from common import IntegrationTest 7 from common import IntegrationTest
8 8
9 9
10 class Bypass(IntegrationTest): 10 class Bypass(IntegrationTest):
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 for response in responses: 95 for response in responses:
96 self.assertNotHasChromeProxyViaHeader(response) 96 self.assertNotHasChromeProxyViaHeader(response)
97 97
98 # Load HTTP page and check that Data Saver is used. 98 # Load HTTP page and check that Data Saver is used.
99 test_driver.LoadURL('http://check.googlezip.net/test.html') 99 test_driver.LoadURL('http://check.googlezip.net/test.html')
100 responses = test_driver.GetHTTPResponses() 100 responses = test_driver.GetHTTPResponses()
101 self.assertNotEqual(0, len(responses)) 101 self.assertNotEqual(0, len(responses))
102 for response in responses: 102 for response in responses:
103 self.assertHasChromeProxyViaHeader(response) 103 self.assertHasChromeProxyViaHeader(response)
104 104
105 # Verify that when Chrome receives a non-4xx response through a Data Reduction
106 # Proxy that doesn't set a proper via header, Chrome falls back to the next
107 # available proxy.
108 def testMissingViaHeaderNon4xxFallback(self):
Robert Ogden 2017/03/14 18:17:03 This belongs in fallback.py.
sclittle 2017/03/14 19:22:28 Done.
109 with TestDriver() as test_driver:
110 test_driver.AddChromeArg('--enable-spdy-proxy-auth')
111
112 # Set the primary Data Reduction Proxy to be the test server, which does
113 # not add any Via headers. The fallback Data Reduction Proxy is set to the
114 # canonical Data Reduction Proxy target.
115 test_driver.AddChromeArg('--data-reduction-proxy-http-proxies='
116 'https://chromeproxy-test.appspot.com;'
117 'http://compress.googlezip.net')
118
119 # Load a page that should fall back off of the test server proxy, and onto
120 # the canonical proxy that will set the correct Via header.
121 test_driver.LoadURL('http://chromeproxy-test.appspot.com/default')
122 responses = test_driver.GetHTTPResponses()
123 self.assertNotEqual(0, len(responses))
124 for response in responses:
125 self.assertHasChromeProxyViaHeader(response)
126 self.assertEqual(u'http/1.1', response.protocol)
127
128 # Check that the BypassTypePrimary histogram has a single entry in the
129 # MissingViaHeaderOther category (which is enum value 5), to make sure
130 # that the bypass was caused by the missing via header logic and not
131 # something else.
132 histogram = test_driver.GetHistogram(
133 "DataReductionProxy.BypassTypePrimary")
134 self.assertEqual(1, histogram['count'])
135 self.assertIn({'count': 1, 'high': 6, 'low': 5}, histogram['buckets'])
105 136
106 if __name__ == '__main__': 137 if __name__ == '__main__':
107 IntegrationTest.RunAllTests() 138 IntegrationTest.RunAllTests()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698