| 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): |
| 11 | 11 |
| 12 # Ensure Chrome does not use Data Saver for block-once, but does use Data |
| 13 # Saver for a subsequent request. |
| 14 def testBlockOnce(self): |
| 15 with TestDriver() as t: |
| 16 t.AddChromeArg('--enable-spdy-proxy-auth') |
| 17 t.LoadURL('http://check.googlezip.net/blocksingle/') |
| 18 responses = t.GetHTTPResponses() |
| 19 self.assertEqual(2, len(responses)) |
| 20 for response in responses: |
| 21 if response.url == "http://check.googlezip.net/image.png": |
| 22 self.assertHasChromeProxyViaHeader(response) |
| 23 else: |
| 24 self.assertNotHasChromeProxyViaHeader(response) |
| 25 |
| 12 # Ensure Chrome does not use Data Saver for block=0, which uses the default | 26 # Ensure Chrome does not use Data Saver for block=0, which uses the default |
| 13 # proxy retry delay. | 27 # proxy retry delay. |
| 14 def testBypass(self): | 28 def testBypass(self): |
| 15 with TestDriver() as t: | 29 with TestDriver() as t: |
| 16 t.AddChromeArg('--enable-spdy-proxy-auth') | 30 t.AddChromeArg('--enable-spdy-proxy-auth') |
| 17 t.LoadURL('http://check.googlezip.net/block/') | 31 t.LoadURL('http://check.googlezip.net/block/') |
| 18 for response in t.GetHTTPResponses(): | 32 for response in t.GetHTTPResponses(): |
| 19 self.assertNotHasChromeProxyViaHeader(response) | 33 self.assertNotHasChromeProxyViaHeader(response) |
| 20 | 34 |
| 21 # Load another page and check that Data Saver is not used. | 35 # Load another page and check that Data Saver is not used. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 44 same_origin_requests = same_origin_requests + 1 | 58 same_origin_requests = same_origin_requests + 1 |
| 45 else: | 59 else: |
| 46 self.assertNotHasChromeProxyViaHeader(response) | 60 self.assertNotHasChromeProxyViaHeader(response) |
| 47 cors_requests = cors_requests + 1 | 61 cors_requests = cors_requests + 1 |
| 48 # Verify that both CORS and same origin requests were seen. | 62 # Verify that both CORS and same origin requests were seen. |
| 49 self.assertNotEqual(0, same_origin_requests) | 63 self.assertNotEqual(0, same_origin_requests) |
| 50 self.assertNotEqual(0, cors_requests) | 64 self.assertNotEqual(0, cors_requests) |
| 51 | 65 |
| 52 if __name__ == '__main__': | 66 if __name__ == '__main__': |
| 53 IntegrationTest.RunAllTests() | 67 IntegrationTest.RunAllTests() |
| OLD | NEW |