Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import time | |
| 6 | |
| 7 import common | |
| 8 from common import TestDriver | |
| 9 from common import IntegrationTest | |
| 10 | |
| 11 | |
| 12 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.
| |
| 13 | |
| 14 # Verify that longer bypasses triggered by the Data Reduction Proxy only last | |
| 15 # as long as they're supposed to, and that the proxy is used once again after | |
| 16 # the bypass has ended. | |
| 17 def testReenableAfterSetBypass(self): | |
| 18 with TestDriver() as test_driver: | |
| 19 test_driver.AddChromeArg('--enable-spdy-proxy-auth') | |
| 20 | |
| 21 # Load URL that triggers a 20-second bypass of all proxies. | |
| 22 test_driver.LoadURL('http://check.googlezip.net/block20/') | |
| 23 responses = test_driver.GetHTTPResponses() | |
| 24 self.assertNotEqual(0, len(responses)) | |
| 25 for response in responses: | |
| 26 self.assertNotHasChromeProxyViaHeader(response) | |
| 27 | |
| 28 # Verify that the Data Reduction Proxy is still bypassed. | |
| 29 test_driver.LoadURL('http://check.googlezip.net/test.html') | |
| 30 responses = test_driver.GetHTTPResponses() | |
| 31 self.assertNotEqual(0, len(responses)) | |
| 32 for response in responses: | |
| 33 self.assertNotHasChromeProxyViaHeader(response) | |
| 34 | |
| 35 # Verify that the Data Reduction Proxy is no longer bypassed after 20 | |
| 36 # seconds. | |
| 37 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
| |
| 38 test_driver.LoadURL('http://check.googlezip.net/test.html') | |
| 39 responses = test_driver.GetHTTPResponses() | |
| 40 self.assertNotEqual(0, len(responses)) | |
| 41 for response in responses: | |
| 42 self.assertHasChromeProxyViaHeader(response) | |
| 43 | |
| 44 # 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
| |
| 45 # directive, Chrome bypasses all proxies for the next 1-5 minutes. | |
| 46 def testReenableAfterBypass(self): | |
| 47 with TestDriver() as test_driver: | |
| 48 test_driver.AddChromeArg('--enable-spdy-proxy-auth') | |
| 49 | |
| 50 # Load URL that triggers a bypass of all proxies that lasts between 1 and | |
| 51 # 5 minutes. | |
| 52 test_driver.LoadURL('http://check.googlezip.net/block/') | |
| 53 responses = test_driver.GetHTTPResponses() | |
| 54 self.assertNotEqual(0, len(responses)) | |
| 55 for response in responses: | |
| 56 self.assertNotHasChromeProxyViaHeader(response) | |
| 57 | |
| 58 # Verify that the Data Reduction Proxy is still bypassed after 30 seconds. | |
| 59 time.sleep(30) | |
| 60 test_driver.LoadURL('http://check.googlezip.net/test.html') | |
| 61 responses = test_driver.GetHTTPResponses() | |
| 62 self.assertNotEqual(0, len(responses)) | |
| 63 for response in responses: | |
| 64 self.assertNotHasChromeProxyViaHeader(response) | |
| 65 | |
| 66 # Verify that the Data Reduction Proxy is no longer bypassed 5 minutes | |
| 67 # after the original bypass was triggered. | |
| 68 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 :)
| |
| 69 test_driver.LoadURL('http://check.googlezip.net/test.html') | |
| 70 responses = test_driver.GetHTTPResponses() | |
| 71 self.assertNotEqual(0, len(responses)) | |
| 72 for response in responses: | |
| 73 self.assertHasChromeProxyViaHeader(response) | |
| 74 | |
| 75 | |
| 76 if __name__ == '__main__': | |
| 77 IntegrationTest.RunAllTests() | |
| OLD | NEW |