Chromium Code Reviews| 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..f2b7abcfea25962f8df9e37f13363c836b305516 |
| --- /dev/null |
| +++ b/tools/chrome_proxy/webdriver/reenable_after_bypass.py |
| @@ -0,0 +1,77 @@ |
| +# 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): |
|
Robert Ogden
2017/04/04 19:42:59
Go ahead and just stick these in the bypass.py fil
sclittle
2017/04/04 20:41:24
Are you sure? These tests take a really really lon
Robert Ogden
2017/04/04 20:44:25
Ah, that's right, we talked about this. What you h
RyanSturm
2017/04/05 18:42:09
Can you add a comment about this issue, so they ar
sclittle
2017/04/05 18:59:08
Done.
|
| + |
| + # 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) |
|
Robert Ogden
2017/04/04 19:42:59
Any risk on flakiness here? What about 21 seconds
sclittle
2017/04/04 20:41:24
I was banking on the fact that test_driver.LoadURL
Robert Ogden
2017/04/04 20:44:25
Cool, sgtm
|
| + 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" |
|
RyanSturm
2017/04/05 18:42:09
I thought "block=0" was block once. What is the di
sclittle
2017/04/05 18:59:08
"block=0" bypasses the proxies for a random durati
|
| + # 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) |
|
Robert Ogden
2017/04/04 19:42:59
Same flakiness concern
sclittle
2017/04/04 20:41:24
Similar response as above :)
|
| + 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() |