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

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

Issue 2693193004: Add ChromeDriver test for HTTPS bypass, QUIC smoke test (Closed)
Patch Set: robertogden's comments Created 3 years, 10 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 | tools/chrome_proxy/webdriver/examples.py » ('j') | 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 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):
(...skipping 19 matching lines...) Expand all
30 t.AddChromeArg('--enable-spdy-proxy-auth') 30 t.AddChromeArg('--enable-spdy-proxy-auth')
31 t.LoadURL('http://check.googlezip.net/block/') 31 t.LoadURL('http://check.googlezip.net/block/')
32 for response in t.GetHTTPResponses(): 32 for response in t.GetHTTPResponses():
33 self.assertNotHasChromeProxyViaHeader(response) 33 self.assertNotHasChromeProxyViaHeader(response)
34 34
35 # Load another page and check that Data Saver is not used. 35 # Load another page and check that Data Saver is not used.
36 t.LoadURL('http://check.googlezip.net/test.html') 36 t.LoadURL('http://check.googlezip.net/test.html')
37 for response in t.GetHTTPResponses(): 37 for response in t.GetHTTPResponses():
38 self.assertNotHasChromeProxyViaHeader(response) 38 self.assertNotHasChromeProxyViaHeader(response)
39 39
40 # Ensure Chrome does not use Data Saver for HTTPS requests.
41 def testHttpsBypass(self):
42 with TestDriver() as t:
43 t.AddChromeArg('--enable-spdy-proxy-auth')
44
45 # Load HTTP page and check that Data Saver is used.
46 t.LoadURL('http://check.googlezip.net/test.html')
47 responses = t.GetHTTPResponses()
48 self.assertEqual(2, len(responses))
49 for response in t.GetHTTPResponses():
50 self.assertHasChromeProxyViaHeader(response)
51
52 # Load HTTPS page and check that Data Saver is not used.
53 t.LoadURL('https://check.googlezip.net/test.html')
54 responses = t.GetHTTPResponses()
55 self.assertEqual(2, len(responses))
56 for response in t.GetHTTPResponses():
57 self.assertNotHasChromeProxyViaHeader(response)
58
40 # Verify that CORS requests receive a block-once from the data reduction 59 # Verify that CORS requests receive a block-once from the data reduction
41 # proxy by checking that those requests are retried without data reduction 60 # proxy by checking that those requests are retried without data reduction
42 # proxy. 61 # proxy.
43 def testCorsBypass(self): 62 def testCorsBypass(self):
44 with TestDriver() as test_driver: 63 with TestDriver() as test_driver:
45 test_driver.AddChromeArg('--enable-spdy-proxy-auth') 64 test_driver.AddChromeArg('--enable-spdy-proxy-auth')
46 test_driver.LoadURL('http://www.gstatic.com/chrome/googlezip/cors/') 65 test_driver.LoadURL('http://www.gstatic.com/chrome/googlezip/cors/')
47 66
48 # Navigate to a different page to verify that later requests are not 67 # Navigate to a different page to verify that later requests are not
49 # blocked. 68 # blocked.
50 test_driver.LoadURL('http://check.googlezip.net/test.html') 69 test_driver.LoadURL('http://check.googlezip.net/test.html')
51 70
52 cors_requests = 0 71 cors_requests = 0
53 same_origin_requests = 0 72 same_origin_requests = 0
54 for response in test_driver.GetHTTPResponses(): 73 for response in test_driver.GetHTTPResponses():
55 # The origin header implies that |response| is a CORS request. 74 # The origin header implies that |response| is a CORS request.
56 if ('origin' not in response.request_headers): 75 if ('origin' not in response.request_headers):
57 self.assertHasChromeProxyViaHeader(response) 76 self.assertHasChromeProxyViaHeader(response)
58 same_origin_requests = same_origin_requests + 1 77 same_origin_requests = same_origin_requests + 1
59 else: 78 else:
60 self.assertNotHasChromeProxyViaHeader(response) 79 self.assertNotHasChromeProxyViaHeader(response)
61 cors_requests = cors_requests + 1 80 cors_requests = cors_requests + 1
62 # Verify that both CORS and same origin requests were seen. 81 # Verify that both CORS and same origin requests were seen.
63 self.assertNotEqual(0, same_origin_requests) 82 self.assertNotEqual(0, same_origin_requests)
64 self.assertNotEqual(0, cors_requests) 83 self.assertNotEqual(0, cors_requests)
65 84
66 if __name__ == '__main__': 85 if __name__ == '__main__':
67 IntegrationTest.RunAllTests() 86 IntegrationTest.RunAllTests()
OLDNEW
« no previous file with comments | « no previous file | tools/chrome_proxy/webdriver/examples.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698