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

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

Issue 2754803004: Client config and QUIC transaction integration tests (Closed)
Patch Set: ps Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 common 5 import common
6 import time
6 from common import TestDriver 7 from common import TestDriver
7 from common import IntegrationTest 8 from common import IntegrationTest
8 from common import NotAndroid 9 from common import NotAndroid
9 10
10 11
11 class Smoke(IntegrationTest): 12 class Smoke(IntegrationTest):
12 13
13 # Ensure Chrome does not use DataSaver in Incognito mode. 14 # Ensure Chrome does not use DataSaver in Incognito mode.
14 # Clank does not honor the --incognito flag. 15 # Clank does not honor the --incognito flag.
15 @NotAndroid 16 @NotAndroid
(...skipping 10 matching lines...) Expand all
26 with TestDriver() as t: 27 with TestDriver() as t:
27 t.AddChromeArg('--enable-spdy-proxy-auth') 28 t.AddChromeArg('--enable-spdy-proxy-auth')
28 t.AddChromeArg('--enable-quic') 29 t.AddChromeArg('--enable-quic')
29 t.AddChromeArg('--data-reduction-proxy-http-proxies=https://proxy.googlezi p.net:443') 30 t.AddChromeArg('--data-reduction-proxy-http-proxies=https://proxy.googlezi p.net:443')
30 t.AddChromeArg('--force-fieldtrials=DataReductionProxyUseQuic/Enabled') 31 t.AddChromeArg('--force-fieldtrials=DataReductionProxyUseQuic/Enabled')
31 t.LoadURL('http://check.googlezip.net/test.html') 32 t.LoadURL('http://check.googlezip.net/test.html')
32 responses = t.GetHTTPResponses() 33 responses = t.GetHTTPResponses()
33 self.assertEqual(2, len(responses)) 34 self.assertEqual(2, len(responses))
34 for response in responses: 35 for response in responses:
35 self.assertHasChromeProxyViaHeader(response) 36 self.assertHasChromeProxyViaHeader(response)
37
38 # Verify that histogram DataReductionProxy.Quic.ProxyStatus has at least 1
39 # sample. This sample must be in bucket 0 (QUIC_PROXY_STATUS_AVAILABLE).
40 proxy_status = t.GetHistogram('DataReductionProxy.Quic.ProxyStatus')
41 self.assertLessEqual(1, proxy_status['count'])
42 self.assertEqual(0, proxy_status['sum'])
43
44 # Navigate to one more page to ensure that established QUIC connection
45 # is used for the next request. Give 3 seconds extra headroom for the QUIC
46 # connection to be established.
47 time.sleep(3)
48 t.LoadURL('http://check.googlezip.net/test.html')
49 proxy_usage = t.GetHistogram('Net.QuicAlternativeProxy.Usage')
50 # Bucket ALTERNATIVE_PROXY_USAGE_NO_RACE should have at least onesample.
51 self.assertLessEqual(1, proxy_usage['buckets'][0]['count'])
36 52
37 # Ensure Chrome uses DataSaver in normal mode. 53 # Ensure Chrome uses DataSaver in normal mode.
38 def testCheckPageWithNormalMode(self): 54 def testCheckPageWithNormalMode(self):
39 with TestDriver() as t: 55 with TestDriver() as t:
40 t.AddChromeArg('--enable-spdy-proxy-auth') 56 t.AddChromeArg('--enable-spdy-proxy-auth')
41 t.LoadURL('http://check.googlezip.net/test.html') 57 t.LoadURL('http://check.googlezip.net/test.html')
42 responses = t.GetHTTPResponses() 58 responses = t.GetHTTPResponses()
43 self.assertNotEqual(0, len(responses)) 59 self.assertNotEqual(0, len(responses))
44 for response in responses: 60 for response in responses:
45 self.assertHasChromeProxyViaHeader(response) 61 self.assertHasChromeProxyViaHeader(response)
46 62
47 # Ensure pageload metric pingback with DataSaver. 63 # Ensure pageload metric pingback with DataSaver.
48 def testPingback(self): 64 def testPingback(self):
49 with TestDriver() as t: 65 with TestDriver() as t:
50 t.AddChromeArg('--enable-spdy-proxy-auth') 66 t.AddChromeArg('--enable-spdy-proxy-auth')
51 t.AddChromeArg('--enable-data-reduction-proxy-force-pingback') 67 t.AddChromeArg('--enable-data-reduction-proxy-force-pingback')
52 t.LoadURL('http://check.googlezip.net/test.html') 68 t.LoadURL('http://check.googlezip.net/test.html')
53 t.LoadURL('http://check.googlezip.net/test.html') 69 t.LoadURL('http://check.googlezip.net/test.html')
54 t.SleepUntilHistogramHasEntry("DataReductionProxy.Pingback.Succeeded") 70 t.SleepUntilHistogramHasEntry("DataReductionProxy.Pingback.Succeeded")
55 # Verify one pingback attempt that was successful. 71 # Verify one pingback attempt that was successful.
56 attempted = t.GetHistogram('DataReductionProxy.Pingback.Attempted') 72 attempted = t.GetHistogram('DataReductionProxy.Pingback.Attempted')
57 self.assertEqual(1, attempted['count']) 73 self.assertEqual(1, attempted['count'])
58 succeeded = t.GetHistogram('DataReductionProxy.Pingback.Succeeded') 74 succeeded = t.GetHistogram('DataReductionProxy.Pingback.Succeeded')
59 self.assertEqual(1, succeeded['count']) 75 self.assertEqual(1, succeeded['count'])
60 76
77 # Ensure client config is fetched at the start of the Chrome session, and the
78 # session ID is correctly set in the chrome-proxy request header.
79 def testClientConfig(self):
80 with TestDriver() as t:
81 t.AddChromeArg('--enable-spdy-proxy-auth')
82 t.SleepUntilHistogramHasEntry(
83 'DataReductionProxy.ConfigService.FetchResponseCode')
84 t.LoadURL('http://check.googlezip.net/test.html')
85 responses = t.GetHTTPResponses()
86 self.assertEqual(2, len(responses))
87 for response in responses:
88 chrome_proxy_header = response.request_headers['chrome-proxy']
89 self.assertIn('s=', chrome_proxy_header)
90 self.assertNotIn('ps=', chrome_proxy_header)
91 self.assertNotIn('sid=', chrome_proxy_header)
92 # Verify that the proxy server honored the session ID.
93 self.assertHasChromeProxyViaHeader(response)
94 self.assertEqual(200, response.status)
95
61 if __name__ == '__main__': 96 if __name__ == '__main__':
62 IntegrationTest.RunAllTests() 97 IntegrationTest.RunAllTests()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698