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

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

Issue 2661363002: Adding a CORS bypass integration test (Closed)
Patch Set: 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 | 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
(Empty)
1 # Copyright 2017 The Chromium Authors. All rights reserved.
megjablon 2017/02/01 00:14:38 The bug and spreadsheet said this should go in byp
RyanSturm 2017/02/01 01:45:41 Done.
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 CorsBypass(IntegrationTest):
11
12 # Verify that CORS requests receive a block-once from the data reduction
13 # proxy by checking that those requests are retried without data reduction
14 # proxy.
15 def testCorsBypass(self):
16 with TestDriver() as test_driver:
17 test_driver.AddChromeArg('--enable-spdy-proxy-auth')
18 test_driver.LoadURL('http://www.gstatic.com/chrome/googlezip/cors/')
19
20 # Navigate to a different page to verify that later requests are not
21 # blocked.
22 test_driver.LoadURL('http://check.googlezip.net/test.html')
23
24 cors_requests = 0
25 same_origin_requests = 0
26 for response in test_driver.GetHTTPResponses():
27 # The origin header implies that |response| is a CORS request.
28 if ('origin' not in response.request_headers):
29 self.assertHasChromeProxyViaHeader(response)
30 same_origin_requests = same_origin_requests + 1
31 else:
32 self.assertNotHasChromeProxyViaHeader(response)
33 cors_requests = cors_requests + 1
34 # Verify that both CORS and same origin requests were seen.
35 self.assertNotEqual(0, same_origin_requests)
36 self.assertNotEqual(0, cors_requests)
37
38 if __name__ == '__main__':
39 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