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

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

Issue 2741263002: Added Data Saver ChromeDriver test for via header fallback logic. (Closed)
Patch Set: moved MissingViaHeaderOther fallback test into fallback.py 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 class Fallback(IntegrationTest): 9 class Fallback(IntegrationTest):
10 10
(...skipping 18 matching lines...) Expand all
29 self.assertTrue( 29 self.assertTrue(
30 test_driver.SleepUntilHistogramHasEntry("DataReductionProxy.ProbeURL")) 30 test_driver.SleepUntilHistogramHasEntry("DataReductionProxy.ProbeURL"))
31 31
32 test_driver.LoadURL('http://check.googlezip.net/test.html') 32 test_driver.LoadURL('http://check.googlezip.net/test.html')
33 responses = test_driver.GetHTTPResponses() 33 responses = test_driver.GetHTTPResponses()
34 self.assertNotEqual(0, len(responses)) 34 self.assertNotEqual(0, len(responses))
35 for response in responses: 35 for response in responses:
36 self.assertHasChromeProxyViaHeader(response) 36 self.assertHasChromeProxyViaHeader(response)
37 self.assertEqual(u'http/1.1', response.protocol) 37 self.assertEqual(u'http/1.1', response.protocol)
38 38
39 # Verify that when Chrome receives a non-4xx response through a Data Reduction
40 # Proxy that doesn't set a proper via header, Chrome falls back to the next
41 # available proxy.
42 def testMissingViaHeaderNon4xxFallback(self):
43 with TestDriver() as test_driver:
44 test_driver.AddChromeArg('--enable-spdy-proxy-auth')
45
46 # Set the primary Data Reduction Proxy to be the test server, which does
47 # not add any Via headers. The fallback Data Reduction Proxy is set to the
48 # canonical Data Reduction Proxy target.
49 test_driver.AddChromeArg('--data-reduction-proxy-http-proxies='
50 'https://chromeproxy-test.appspot.com;'
51 'http://compress.googlezip.net')
52
53 # Load a page that should fall back off of the test server proxy, and onto
54 # the canonical proxy that will set the correct Via header.
55 test_driver.LoadURL('http://chromeproxy-test.appspot.com/default')
56 responses = test_driver.GetHTTPResponses()
57 self.assertNotEqual(0, len(responses))
58 for response in responses:
59 self.assertHasChromeProxyViaHeader(response)
60 self.assertEqual(u'http/1.1', response.protocol)
61
62 # Check that the BypassTypePrimary histogram has a single entry in the
63 # MissingViaHeaderOther category (which is enum value 5), to make sure
64 # that the bypass was caused by the missing via header logic and not
65 # something else.
66 histogram = test_driver.GetHistogram(
67 "DataReductionProxy.BypassTypePrimary")
68 self.assertEqual(1, histogram['count'])
69 self.assertIn({'count': 1, 'high': 6, 'low': 5}, histogram['buckets'])
70
71
39 if __name__ == '__main__': 72 if __name__ == '__main__':
40 IntegrationTest.RunAllTests() 73 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