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

Unified Diff: tools/chrome_proxy/webdriver/cors_bypass.py

Issue 2661363002: Adding a CORS bypass integration test (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/chrome_proxy/webdriver/cors_bypass.py
diff --git a/tools/chrome_proxy/webdriver/cors_bypass.py b/tools/chrome_proxy/webdriver/cors_bypass.py
new file mode 100644
index 0000000000000000000000000000000000000000..b9515dbf4c5c507bcdae92646c6841dba3f2e8b2
--- /dev/null
+++ b/tools/chrome_proxy/webdriver/cors_bypass.py
@@ -0,0 +1,39 @@
+# 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.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import common
+from common import TestDriver
+from common import IntegrationTest
+
+
+class CorsBypass(IntegrationTest):
+
+ # Verify that CORS requests receive a block-once from the data reduction
+ # proxy by checking that those requests are retried without data reduction
+ # proxy.
+ def testCorsBypass(self):
+ with TestDriver() as test_driver:
+ test_driver.AddChromeArg('--enable-spdy-proxy-auth')
+ test_driver.LoadURL('http://www.gstatic.com/chrome/googlezip/cors/')
+
+ # Navigate to a different page to verify that later requests are not
+ # blocked.
+ test_driver.LoadURL('http://check.googlezip.net/test.html')
+
+ cors_requests = 0
+ same_origin_requests = 0
+ for response in test_driver.GetHTTPResponses():
+ # The origin header implies that |response| is a CORS request.
+ if ('origin' not in response.request_headers):
+ self.assertHasChromeProxyViaHeader(response)
+ same_origin_requests = same_origin_requests + 1
+ else:
+ self.assertNotHasChromeProxyViaHeader(response)
+ cors_requests = cors_requests + 1
+ # Verify that both CORS and same origin requests were seen.
+ self.assertNotEqual(0, same_origin_requests)
+ self.assertNotEqual(0, cors_requests)
+
+if __name__ == '__main__':
+ IntegrationTest.RunAllTests()
« 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