Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: tools/chrome_proxy/webdriver/quic.py

Issue 2869863002: Enable QUIC for non core data saver proxies (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 time 5 import time
6 6
7 import common 7 import common
8 from common import TestDriver 8 from common import TestDriver
9 from common import IntegrationTest 9 from common import IntegrationTest
10 10
11 11
12 class Quic(IntegrationTest): 12 class Quic(IntegrationTest):
13 13
14 # Ensure Chrome uses DataSaver when QUIC is enabled. This test should pass 14 # Ensure Chrome uses DataSaver when QUIC is enabled. This test should pass
15 # even if QUIC is disabled on the server side. In that case, Chrome should 15 # even if QUIC is disabled on the server side. In that case, Chrome should
16 # fallback to using the non-QUIC proxies. 16 # fallback to using the non-QUIC proxies.
17 def testCheckPageWithQuicProxy(self): 17 def testCheckPageWithQuicProxy(self):
18 with TestDriver() as t: 18 with TestDriver() as t:
19 t.AddChromeArg('--enable-spdy-proxy-auth') 19 t.AddChromeArg('--enable-spdy-proxy-auth')
20
21 # Enable QUIC (including for non-core HTTPS proxies).
20 t.AddChromeArg('--enable-quic') 22 t.AddChromeArg('--enable-quic')
21 # Enable QUIC for non-core HTTPS proxies. 23 t.AddChromeArg('--force-fieldtrials=DataReductionProxyUseQuic/Enabled')
24 t.AddChromeArg('--force-fieldtrial-params='
25 'DataReductionProxyUseQuic.Enabled:enable_quic_non_core_proxies/true')
26 # Enable usage of QUIC for non-core proxies via switch for older versions
27 # of Chrome.
megjablon 2017/05/09 18:16:22 Can you add the version for this change? Something
tbansal1 2017/05/09 23:57:41 Done.
22 t.AddChromeArg('--data-reduction-proxy-enable-quic-on-non-core-proxies') 28 t.AddChromeArg('--data-reduction-proxy-enable-quic-on-non-core-proxies')
23 t.AddChromeArg('--force-fieldtrials=DataReductionProxyUseQuic/Enabled') 29
24 t.LoadURL('http://check.googlezip.net/test.html') 30 t.LoadURL('http://check.googlezip.net/test.html')
25 responses = t.GetHTTPResponses() 31 responses = t.GetHTTPResponses()
26 self.assertEqual(2, len(responses)) 32 self.assertEqual(2, len(responses))
27 for response in responses: 33 for response in responses:
28 self.assertHasChromeProxyViaHeader(response) 34 self.assertHasChromeProxyViaHeader(response)
29 35
30 # Ensure Chrome uses QUIC DataSaver proxy when QUIC is enabled. This test 36 # Ensure Chrome uses QUIC DataSaver proxy when QUIC is enabled. This test
31 # may fail if QUIC is disabled on the server side. 37 # may fail if QUIC is disabled on the server side.
32 def testCheckPageWithQuicProxyTransaction(self): 38 def testCheckPageWithQuicProxyTransaction(self):
33 with TestDriver() as t: 39 with TestDriver() as t:
34 t.AddChromeArg('--enable-spdy-proxy-auth') 40 t.AddChromeArg('--enable-spdy-proxy-auth')
41
42 # Enable QUIC (including for non-core HTTPS proxies).
35 t.AddChromeArg('--enable-quic') 43 t.AddChromeArg('--enable-quic')
36 # Enable QUIC for non-core HTTPS proxies. 44 t.AddChromeArg('--force-fieldtrials=DataReductionProxyUseQuic/Enabled')
45 t.AddChromeArg('--force-fieldtrial-params='
46 'DataReductionProxyUseQuic.Enabled:enable_quic_non_core_proxies/true')
47 # Enable usage of QUIC for non-core proxies via switch for older versions
48 # of Chrome.
megjablon 2017/05/09 18:16:22 Same here.
tbansal1 2017/05/09 23:57:41 Done.
37 t.AddChromeArg('--data-reduction-proxy-enable-quic-on-non-core-proxies') 49 t.AddChromeArg('--data-reduction-proxy-enable-quic-on-non-core-proxies')
38 t.AddChromeArg('--force-fieldtrials=DataReductionProxyUseQuic/Enabled') 50
39 t.LoadURL('http://check.googlezip.net/test.html') 51 t.LoadURL('http://check.googlezip.net/test.html')
40 responses = t.GetHTTPResponses() 52 responses = t.GetHTTPResponses()
41 self.assertEqual(2, len(responses)) 53 self.assertEqual(2, len(responses))
42 for response in responses: 54 for response in responses:
43 self.assertHasChromeProxyViaHeader(response) 55 self.assertHasChromeProxyViaHeader(response)
44 56
45 # Verify that histogram DataReductionProxy.Quic.ProxyStatus has at least 1 57 # Verify that histogram DataReductionProxy.Quic.ProxyStatus has at least 1
46 # sample. This sample must be in bucket 0 (QUIC_PROXY_STATUS_AVAILABLE). 58 # sample. This sample must be in bucket 0 (QUIC_PROXY_STATUS_AVAILABLE).
47 proxy_status = t.GetHistogram('DataReductionProxy.Quic.ProxyStatus') 59 proxy_status = t.GetHistogram('DataReductionProxy.Quic.ProxyStatus')
48 self.assertLessEqual(1, proxy_status['count']) 60 self.assertLessEqual(1, proxy_status['count'])
49 self.assertEqual(0, proxy_status['sum']) 61 self.assertEqual(0, proxy_status['sum'])
50 62
51 # Navigate to one more page to ensure that established QUIC connection 63 # Navigate to one more page to ensure that established QUIC connection
52 # is used for the next request. Give 3 seconds extra headroom for the QUIC 64 # is used for the next request. Give 3 seconds extra headroom for the QUIC
53 # connection to be established. 65 # connection to be established.
54 time.sleep(3) 66 time.sleep(3)
55 t.LoadURL('http://check.googlezip.net/test.html') 67 t.LoadURL('http://check.googlezip.net/test.html')
56 proxy_usage = t.GetHistogram('Net.QuicAlternativeProxy.Usage') 68 proxy_usage = t.GetHistogram('Net.QuicAlternativeProxy.Usage')
57 # Bucket ALTERNATIVE_PROXY_USAGE_NO_RACE should have at least onesample. 69 # Bucket ALTERNATIVE_PROXY_USAGE_NO_RACE should have at least onesample.
58 self.assertLessEqual(1, proxy_usage['buckets'][0]['count']) 70 self.assertLessEqual(1, proxy_usage['buckets'][0]['count'])
59 71
60 if __name__ == '__main__': 72 if __name__ == '__main__':
61 IntegrationTest.RunAllTests() 73 IntegrationTest.RunAllTests()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698