| OLD | NEW |
| (Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import common |
| 6 from common import TestDriver |
| 7 from common import IntegrationTest |
| 8 |
| 9 |
| 10 class Quic(IntegrationTest): |
| 11 |
| 12 # Ensure Chrome uses DataSaver when QUIC is enabled. This test should pass |
| 13 # even if QUIC is disabled on the server side. In that case, Chrome should |
| 14 # fallback to using the non-QUIC proxies. |
| 15 def testCheckPageWithQuicProxy(self): |
| 16 with TestDriver() as t: |
| 17 t.AddChromeArg('--enable-spdy-proxy-auth') |
| 18 t.AddChromeArg('--enable-quic') |
| 19 # Enable QUIC for non-core HTTPS proxies. |
| 20 t.AddChromeArg('--data-reduction-proxy-enable-quic-on-non-core-proxies') |
| 21 t.AddChromeArg('--force-fieldtrials=DataReductionProxyUseQuic/Enabled') |
| 22 t.LoadURL('http://check.googlezip.net/test.html') |
| 23 responses = t.GetHTTPResponses() |
| 24 self.assertEqual(2, len(responses)) |
| 25 for response in responses: |
| 26 self.assertHasChromeProxyViaHeader(response) |
| 27 |
| 28 # Ensure Chrome uses QUIC DataSaver proxy when QUIC is enabled. This test |
| 29 # may fail if QUIC is disabled on the server side. |
| 30 def testCheckPageWithQuicProxyTransaction(self): |
| 31 with TestDriver() as t: |
| 32 t.AddChromeArg('--enable-spdy-proxy-auth') |
| 33 t.AddChromeArg('--enable-quic') |
| 34 # Enable QUIC for non-core HTTPS proxies. |
| 35 t.AddChromeArg('--data-reduction-proxy-enable-quic-on-non-core-proxies') |
| 36 t.AddChromeArg('--force-fieldtrials=DataReductionProxyUseQuic/Enabled') |
| 37 t.LoadURL('http://check.googlezip.net/test.html') |
| 38 responses = t.GetHTTPResponses() |
| 39 self.assertEqual(2, len(responses)) |
| 40 for response in responses: |
| 41 self.assertHasChromeProxyViaHeader(response) |
| 42 |
| 43 # Verify that histogram DataReductionProxy.Quic.ProxyStatus has at least 1 |
| 44 # sample. This sample must be in bucket 0 (QUIC_PROXY_STATUS_AVAILABLE). |
| 45 proxy_status = t.GetHistogram('DataReductionProxy.Quic.ProxyStatus') |
| 46 self.assertLessEqual(1, proxy_status['count']) |
| 47 self.assertEqual(0, proxy_status['sum']) |
| 48 |
| 49 # Navigate to one more page to ensure that established QUIC connection |
| 50 # is used for the next request. Give 3 seconds extra headroom for the QUIC |
| 51 # connection to be established. |
| 52 time.sleep(3) |
| 53 t.LoadURL('http://check.googlezip.net/test.html') |
| 54 proxy_usage = t.GetHistogram('Net.QuicAlternativeProxy.Usage') |
| 55 # Bucket ALTERNATIVE_PROXY_USAGE_NO_RACE should have at least onesample. |
| 56 self.assertLessEqual(1, proxy_usage['buckets'][0]['count']) |
| 57 |
| 58 if __name__ == '__main__': |
| 59 IntegrationTest.RunAllTests() |
| OLD | NEW |