| 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 | 9 |
| 10 class Bypass(IntegrationTest): | 10 class Bypass(IntegrationTest): |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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. |
| 133 histogram = test_driver.GetHistogram( | 133 histogram = test_driver.GetHistogram( |
| 134 "DataReductionProxy.BlockTypePrimary") | 134 "DataReductionProxy.BlockTypePrimary") |
| 135 self.assertEqual(1, histogram['count']) | 135 self.assertEqual(1, histogram['count']) |
| 136 self.assertIn({'count': 1, 'high': 5, 'low': 4}, histogram['buckets']) | 136 self.assertIn({'count': 1, 'high': 5, 'low': 4}, histogram['buckets']) |
| 137 | 137 |
| 138 # Verify that the Data Reduction Proxy understands the "exp" directive. | 138 # Verify that the Data Reduction Proxy understands the "exp" directive. |
| 139 def testExpDirectiveBypass(self): | 139 def testExpDirectiveBypass(self): |
| 140 # If it was attempted to run with another experiment, skip this test. |
| 141 if common.ParseFlags().browser_args and ('--data-reduction-proxy-experiment' |
| 142 in common.ParseFlags().browser_args): |
| 143 self.skipTest('This test cannot be run with other experiments.') |
| 140 with TestDriver() as test_driver: | 144 with TestDriver() as test_driver: |
| 141 test_driver.AddChromeArg('--enable-spdy-proxy-auth') | 145 test_driver.AddChromeArg('--enable-spdy-proxy-auth') |
| 142 test_driver.AddChromeArg('--data-reduction-proxy-experiment=test') | 146 test_driver.AddChromeArg('--data-reduction-proxy-experiment=test') |
| 143 | 147 |
| 144 # Verify that loading a page other than the specific exp directive test | 148 # Verify that loading a page other than the specific exp directive test |
| 145 # page loads through the proxy without being bypassed. | 149 # page loads through the proxy without being bypassed. |
| 146 test_driver.LoadURL('http://check.googlezip.net/test.html') | 150 test_driver.LoadURL('http://check.googlezip.net/test.html') |
| 147 responses = test_driver.GetHTTPResponses() | 151 responses = test_driver.GetHTTPResponses() |
| 148 self.assertNotEqual(0, len(responses)) | 152 self.assertNotEqual(0, len(responses)) |
| 149 for response in responses: | 153 for response in responses: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 164 | 168 |
| 165 test_driver.LoadURL('http://check.googlezip.net/exp/') | 169 test_driver.LoadURL('http://check.googlezip.net/exp/') |
| 166 responses = test_driver.GetHTTPResponses() | 170 responses = test_driver.GetHTTPResponses() |
| 167 self.assertNotEqual(0, len(responses)) | 171 self.assertNotEqual(0, len(responses)) |
| 168 for response in responses: | 172 for response in responses: |
| 169 self.assertHasChromeProxyViaHeader(response) | 173 self.assertHasChromeProxyViaHeader(response) |
| 170 | 174 |
| 171 | 175 |
| 172 if __name__ == '__main__': | 176 if __name__ == '__main__': |
| 173 IntegrationTest.RunAllTests() | 177 IntegrationTest.RunAllTests() |
| OLD | NEW |