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

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

Issue 2793673002: Add Data Saver ChromeDriver tests for long bypasses. (Closed)
Patch Set: added class comment for ReenableAfterBypass. Created 3 years, 8 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/reenable_after_bypass.py
diff --git a/tools/chrome_proxy/webdriver/reenable_after_bypass.py b/tools/chrome_proxy/webdriver/reenable_after_bypass.py
new file mode 100644
index 0000000000000000000000000000000000000000..b5e9daf68e6c9b49fb65c77451958e4549b8c37b
--- /dev/null
+++ b/tools/chrome_proxy/webdriver/reenable_after_bypass.py
@@ -0,0 +1,83 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import time
+
+import common
+from common import TestDriver
+from common import IntegrationTest
+
+
+class ReenableAfterBypass(IntegrationTest):
+ """Tests for ensuring that DRPs are reenabled after bypasses expire.
+
+ These tests take a very long time to run since they wait for their respective
+ bypasses to expire. These tests have been separated out into their own file in
+ order to make it easier to run these tests separately from the others.
+ """
+
+ # Verify that longer bypasses triggered by the Data Reduction Proxy only last
+ # as long as they're supposed to, and that the proxy is used once again after
+ # the bypass has ended.
+ def testReenableAfterSetBypass(self):
+ with TestDriver() as test_driver:
+ test_driver.AddChromeArg('--enable-spdy-proxy-auth')
+
+ # Load URL that triggers a 20-second bypass of all proxies.
+ test_driver.LoadURL('http://check.googlezip.net/block20/')
+ responses = test_driver.GetHTTPResponses()
+ self.assertNotEqual(0, len(responses))
+ for response in responses:
+ self.assertNotHasChromeProxyViaHeader(response)
+
+ # Verify that the Data Reduction Proxy is still bypassed.
+ test_driver.LoadURL('http://check.googlezip.net/test.html')
+ responses = test_driver.GetHTTPResponses()
+ self.assertNotEqual(0, len(responses))
+ for response in responses:
+ self.assertNotHasChromeProxyViaHeader(response)
+
+ # Verify that the Data Reduction Proxy is no longer bypassed after 20
+ # seconds.
+ time.sleep(20)
+ test_driver.LoadURL('http://check.googlezip.net/test.html')
+ responses = test_driver.GetHTTPResponses()
+ self.assertNotEqual(0, len(responses))
+ for response in responses:
+ self.assertHasChromeProxyViaHeader(response)
+
+ # Verify that when the Data Reduction Proxy responds with the "block=0"
+ # directive, Chrome bypasses all proxies for the next 1-5 minutes.
+ def testReenableAfterBypass(self):
+ with TestDriver() as test_driver:
+ test_driver.AddChromeArg('--enable-spdy-proxy-auth')
+
+ # Load URL that triggers a bypass of all proxies that lasts between 1 and
+ # 5 minutes.
+ test_driver.LoadURL('http://check.googlezip.net/block/')
+ responses = test_driver.GetHTTPResponses()
+ self.assertNotEqual(0, len(responses))
+ for response in responses:
+ self.assertNotHasChromeProxyViaHeader(response)
+
+ # Verify that the Data Reduction Proxy is still bypassed after 30 seconds.
+ time.sleep(30)
+ test_driver.LoadURL('http://check.googlezip.net/test.html')
+ responses = test_driver.GetHTTPResponses()
+ self.assertNotEqual(0, len(responses))
+ for response in responses:
+ self.assertNotHasChromeProxyViaHeader(response)
+
+ # Verify that the Data Reduction Proxy is no longer bypassed 5 minutes
+ # after the original bypass was triggered.
+ time.sleep(60 * 4 + 30)
+ test_driver.LoadURL('http://check.googlezip.net/test.html')
+ responses = test_driver.GetHTTPResponses()
+ self.assertNotEqual(0, len(responses))
+ for response in responses:
+ self.assertHasChromeProxyViaHeader(response)
+
+
+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