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

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

Issue 2845803002: Adding a pid= Chrome-Proxy smoke test (Closed)
Patch Set: robertogden nit 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
« 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 import time
7 from common import TestDriver 7 from common import TestDriver
8 from common import IntegrationTest 8 from common import IntegrationTest
9 from decorators import NotAndroid 9 from decorators import NotAndroid
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 self.assertEqual(2, len(responses)) 58 self.assertEqual(2, len(responses))
59 for response in responses: 59 for response in responses:
60 chrome_proxy_header = response.request_headers['chrome-proxy'] 60 chrome_proxy_header = response.request_headers['chrome-proxy']
61 self.assertIn('s=', chrome_proxy_header) 61 self.assertIn('s=', chrome_proxy_header)
62 self.assertNotIn('ps=', chrome_proxy_header) 62 self.assertNotIn('ps=', chrome_proxy_header)
63 self.assertNotIn('sid=', chrome_proxy_header) 63 self.assertNotIn('sid=', chrome_proxy_header)
64 # Verify that the proxy server honored the session ID. 64 # Verify that the proxy server honored the session ID.
65 self.assertHasChromeProxyViaHeader(response) 65 self.assertHasChromeProxyViaHeader(response)
66 self.assertEqual(200, response.status) 66 self.assertEqual(200, response.status)
67 67
68 # Verify unique page IDs are sent in the Chrome-Proxy header.
69 def testPageID(self):
70 with TestDriver() as t:
71 t.AddChromeArg('--enable-spdy-proxy-auth')
72 page_identifiers = []
73 page_loads = 5
74
75 for i in range (0, page_loads):
76 t.LoadURL('http://check.googlezip.net/test.html')
77 responses = t.GetHTTPResponses()
78 self.assertEqual(2, len(responses))
79 pid_in_page_count = 0
80 page_id = ''
81 for response in responses:
82 chrome_proxy_header = response.request_headers['chrome-proxy']
83 chrome_proxy_directives = chrome_proxy_header.split(',')
84 for directive in chrome_proxy_directives:
85 if 'pid=' in directive:
86 pid_in_page_count = pid_in_page_count+1
87 page_id = directive.split('=')[1]
88 self.assertNotEqual('', page_id)
89 self.assertNotIn(page_id, page_identifiers)
90 self.assertHasChromeProxyViaHeader(response)
91 self.assertEqual(200, response.status)
92 page_identifiers.append(page_id)
93 self.assertEqual(1, pid_in_page_count)
94 self.assertEqual(page_loads, len(page_identifiers))
tbansal1 2017/05/01 22:32:13 Is it possible that only this assert fails without
95
68 # Ensure that block causes resources to load from the origin directly. 96 # Ensure that block causes resources to load from the origin directly.
69 def testCheckBlockIsWorking(self): 97 def testCheckBlockIsWorking(self):
70 with TestDriver() as t: 98 with TestDriver() as t:
71 t.AddChromeArg('--enable-spdy-proxy-auth') 99 t.AddChromeArg('--enable-spdy-proxy-auth')
72 t.LoadURL('http://check.googlezip.net/block') 100 t.LoadURL('http://check.googlezip.net/block')
73 responses = t.GetHTTPResponses() 101 responses = t.GetHTTPResponses()
74 self.assertNotEqual(0, len(responses)) 102 self.assertNotEqual(0, len(responses))
75 for response in responses: 103 for response in responses:
76 self.assertNotHasChromeProxyViaHeader(response) 104 self.assertNotHasChromeProxyViaHeader(response)
77 105
78 # Ensure image, css, and javascript resources are compressed. 106 # Ensure image, css, and javascript resources are compressed.
79 def testCheckImageCssJavascriptIsCompressed(self): 107 def testCheckImageCssJavascriptIsCompressed(self):
80 with TestDriver() as t: 108 with TestDriver() as t:
81 t.AddChromeArg('--enable-spdy-proxy-auth') 109 t.AddChromeArg('--enable-spdy-proxy-auth')
82 t.LoadURL('http://check.googlezip.net/static') 110 t.LoadURL('http://check.googlezip.net/static')
83 # http://check.googlezip.net/static is a test page that has 111 # http://check.googlezip.net/static is a test page that has
84 # image/css/javascript resources. 112 # image/css/javascript resources.
85 responses = t.GetHTTPResponses() 113 responses = t.GetHTTPResponses()
86 self.assertNotEqual(0, len(responses)) 114 self.assertNotEqual(0, len(responses))
87 for response in responses: 115 for response in responses:
88 self.assertHasChromeProxyViaHeader(response) 116 self.assertHasChromeProxyViaHeader(response)
89 117
90 if __name__ == '__main__': 118 if __name__ == '__main__':
91 IntegrationTest.RunAllTests() 119 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