Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. | |
|
megjablon
2017/02/01 00:14:38
The bug and spreadsheet said this should go in byp
RyanSturm
2017/02/01 01:45:41
Done.
| |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import common | |
| 6 from common import TestDriver | |
| 7 from common import IntegrationTest | |
| 8 | |
| 9 | |
| 10 class CorsBypass(IntegrationTest): | |
| 11 | |
| 12 # Verify that CORS requests receive a block-once from the data reduction | |
| 13 # proxy by checking that those requests are retried without data reduction | |
| 14 # proxy. | |
| 15 def testCorsBypass(self): | |
| 16 with TestDriver() as test_driver: | |
| 17 test_driver.AddChromeArg('--enable-spdy-proxy-auth') | |
| 18 test_driver.LoadURL('http://www.gstatic.com/chrome/googlezip/cors/') | |
| 19 | |
| 20 # Navigate to a different page to verify that later requests are not | |
| 21 # blocked. | |
| 22 test_driver.LoadURL('http://check.googlezip.net/test.html') | |
| 23 | |
| 24 cors_requests = 0 | |
| 25 same_origin_requests = 0 | |
| 26 for response in test_driver.GetHTTPResponses(): | |
| 27 # The origin header implies that |response| is a CORS request. | |
| 28 if ('origin' not in response.request_headers): | |
| 29 self.assertHasChromeProxyViaHeader(response) | |
| 30 same_origin_requests = same_origin_requests + 1 | |
| 31 else: | |
| 32 self.assertNotHasChromeProxyViaHeader(response) | |
| 33 cors_requests = cors_requests + 1 | |
| 34 # Verify that both CORS and same origin requests were seen. | |
| 35 self.assertNotEqual(0, same_origin_requests) | |
| 36 self.assertNotEqual(0, cors_requests) | |
| 37 | |
| 38 if __name__ == '__main__': | |
| 39 IntegrationTest.RunAllTests() | |
| OLD | NEW |