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

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

Issue 2816823002: Fixing flaky integration test (Closed)
Patch Set: rebase Created 3 years, 8 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 # proper via header. Chrome should bypass all proxies and retry the 119 # proper via header. Chrome should bypass all proxies and retry the
120 # request. 120 # request.
121 test_driver.LoadURL( 121 test_driver.LoadURL(
122 'http://chromeproxy-test.appspot.com/default?respStatus=414') 122 'http://chromeproxy-test.appspot.com/default?respStatus=414')
123 responses = test_driver.GetHTTPResponses() 123 responses = test_driver.GetHTTPResponses()
124 self.assertNotEqual(0, len(responses)) 124 self.assertNotEqual(0, len(responses))
125 for response in responses: 125 for response in responses:
126 self.assertNotHasChromeProxyViaHeader(response) 126 self.assertNotHasChromeProxyViaHeader(response)
127 self.assertEqual(u'http/1.1', response.protocol) 127 self.assertEqual(u'http/1.1', response.protocol)
128 128
129 # Check that the BlockTypePrimary histogram has a single entry in the 129 # Check that the BlockTypePrimary histogram has at least one entry in the
130 # MissingViaHeader4xx category (which is enum value 4), to make sure that 130 # MissingViaHeader4xx category (which is enum value 4), to make sure that
131 # the bypass was caused by the missing via header logic and not something 131 # the bypass was caused by the missing via header logic and not something
132 # else. 132 # else. The favicon for this URL may also be fetched, but will return a
133 # 404.
133 histogram = test_driver.GetHistogram( 134 histogram = test_driver.GetHistogram(
134 "DataReductionProxy.BlockTypePrimary") 135 "DataReductionProxy.BlockTypePrimary")
135 self.assertEqual(1, histogram['count']) 136 self.assertNotEqual(0, histogram['count'])
136 self.assertIn({'count': 1, 'high': 5, 'low': 4}, histogram['buckets']) 137 self.assertEqual(1, len(histogram['buckets']))
138 self.assertEqual(5, histogram['buckets'][0]['high'])
139 self.assertEqual(4, histogram['buckets'][0]['low'])
137 140
138 # Verify that the Data Reduction Proxy understands the "exp" directive. 141 # Verify that the Data Reduction Proxy understands the "exp" directive.
139 def testExpDirectiveBypass(self): 142 def testExpDirectiveBypass(self):
140 # If it was attempted to run with another experiment, skip this test. 143 # If it was attempted to run with another experiment, skip this test.
141 if common.ParseFlags().browser_args and ('--data-reduction-proxy-experiment' 144 if common.ParseFlags().browser_args and ('--data-reduction-proxy-experiment'
142 in common.ParseFlags().browser_args): 145 in common.ParseFlags().browser_args):
143 self.skipTest('This test cannot be run with other experiments.') 146 self.skipTest('This test cannot be run with other experiments.')
144 with TestDriver() as test_driver: 147 with TestDriver() as test_driver:
145 test_driver.AddChromeArg('--enable-spdy-proxy-auth') 148 test_driver.AddChromeArg('--enable-spdy-proxy-auth')
146 test_driver.AddChromeArg('--data-reduction-proxy-experiment=test') 149 test_driver.AddChromeArg('--data-reduction-proxy-experiment=test')
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 test_driver.AddChromeArg('--data-reduction-proxy-http-proxies=' 187 test_driver.AddChromeArg('--data-reduction-proxy-http-proxies='
185 'http://compress.googlezip.net') 188 'http://compress.googlezip.net')
186 189
187 test_driver.LoadURL('http://check.googlezip.net/fallback/') 190 test_driver.LoadURL('http://check.googlezip.net/fallback/')
188 responses = test_driver.GetHTTPResponses() 191 responses = test_driver.GetHTTPResponses()
189 self.assertNotEqual(0, len(responses)) 192 self.assertNotEqual(0, len(responses))
190 for response in responses: 193 for response in responses:
191 self.assertEqual(80, response.port) 194 self.assertEqual(80, response.port)
192 195
193 if __name__ == '__main__': 196 if __name__ == '__main__':
194 IntegrationTest.RunAllTests() 197 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