| OLD | NEW |
| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 # Check that the BypassTypePrimary histogram has a single entry in the | 62 # Check that the BypassTypePrimary histogram has a single entry in the |
| 63 # MissingViaHeaderOther category (which is enum value 5), to make sure | 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 | 64 # that the bypass was caused by the missing via header logic and not |
| 65 # something else. | 65 # something else. |
| 66 histogram = test_driver.GetHistogram( | 66 histogram = test_driver.GetHistogram( |
| 67 "DataReductionProxy.BypassTypePrimary") | 67 "DataReductionProxy.BypassTypePrimary") |
| 68 self.assertEqual(1, histogram['count']) | 68 self.assertEqual(1, histogram['count']) |
| 69 self.assertIn({'count': 1, 'high': 6, 'low': 5}, histogram['buckets']) | 69 self.assertIn({'count': 1, 'high': 6, 'low': 5}, histogram['buckets']) |
| 70 | 70 |
| 71 # DataSaver uses a https proxy by default, if that fails it will fall back to |
| 72 # a http proxy; and if that fails, it will fall back to a direct connection |
| 73 def testHTTPToDirectFallback(self): |
| 74 with TestDriver() as test_driver: |
| 75 test_driver.AddChromeArg('--enable-spdy-proxy-auth') |
| 76 # set the primary (https) proxy to a bad one. |
| 77 # That will force DataSaver to the http proxy for normal page requests. |
| 78 test_driver.AddChromeArg('--spdy-proxy-auth-origin=' |
| 79 'https://nonexistent.googlezip.net') |
| 80 test_driver.AddChromeArg('--data-reduction-proxy-http-proxies=' |
| 81 'http://nonexistent.googlezip.net;' |
| 82 'http://compress.googlezip.net') |
| 83 |
| 84 test_driver.LoadURL('http://check.googlezip.net/fallback/') |
| 85 responses = test_driver.GetHTTPResponses() |
| 86 self.assertNotEqual(0, len(responses)) |
| 87 for response in responses: |
| 88 self.assertEqual(80, response.port) |
| 71 | 89 |
| 90 test_driver.LoadURL('http://check.googlezip.net/block/') |
| 91 responses = test_driver.GetHTTPResponses() |
| 92 self.assertNotEqual(0, len(responses)) |
| 93 for response in responses: |
| 94 self.assertNotHasChromeProxyViaHeader(response) |
| 95 |
| 72 if __name__ == '__main__': | 96 if __name__ == '__main__': |
| 73 IntegrationTest.RunAllTests() | 97 IntegrationTest.RunAllTests() |
| OLD | NEW |