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

Side by Side 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 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.
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):
13 """Tests for ensuring that DRPs are reenabled after bypasses expire.
14
15 These tests take a very long time to run since they wait for their respective
16 bypasses to expire. These tests have been separated out into their own file in
17 order to make it easier to run these tests separately from the others.
18 """
19
20 # Verify that longer bypasses triggered by the Data Reduction Proxy only last
21 # as long as they're supposed to, and that the proxy is used once again after
22 # the bypass has ended.
23 def testReenableAfterSetBypass(self):
24 with TestDriver() as test_driver:
25 test_driver.AddChromeArg('--enable-spdy-proxy-auth')
26
27 # Load URL that triggers a 20-second bypass of all proxies.
28 test_driver.LoadURL('http://check.googlezip.net/block20/')
29 responses = test_driver.GetHTTPResponses()
30 self.assertNotEqual(0, len(responses))
31 for response in responses:
32 self.assertNotHasChromeProxyViaHeader(response)
33
34 # Verify that the Data Reduction Proxy is still bypassed.
35 test_driver.LoadURL('http://check.googlezip.net/test.html')
36 responses = test_driver.GetHTTPResponses()
37 self.assertNotEqual(0, len(responses))
38 for response in responses:
39 self.assertNotHasChromeProxyViaHeader(response)
40
41 # Verify that the Data Reduction Proxy is no longer bypassed after 20
42 # seconds.
43 time.sleep(20)
44 test_driver.LoadURL('http://check.googlezip.net/test.html')
45 responses = test_driver.GetHTTPResponses()
46 self.assertNotEqual(0, len(responses))
47 for response in responses:
48 self.assertHasChromeProxyViaHeader(response)
49
50 # Verify that when the Data Reduction Proxy responds with the "block=0"
51 # directive, Chrome bypasses all proxies for the next 1-5 minutes.
52 def testReenableAfterBypass(self):
53 with TestDriver() as test_driver:
54 test_driver.AddChromeArg('--enable-spdy-proxy-auth')
55
56 # Load URL that triggers a bypass of all proxies that lasts between 1 and
57 # 5 minutes.
58 test_driver.LoadURL('http://check.googlezip.net/block/')
59 responses = test_driver.GetHTTPResponses()
60 self.assertNotEqual(0, len(responses))
61 for response in responses:
62 self.assertNotHasChromeProxyViaHeader(response)
63
64 # Verify that the Data Reduction Proxy is still bypassed after 30 seconds.
65 time.sleep(30)
66 test_driver.LoadURL('http://check.googlezip.net/test.html')
67 responses = test_driver.GetHTTPResponses()
68 self.assertNotEqual(0, len(responses))
69 for response in responses:
70 self.assertNotHasChromeProxyViaHeader(response)
71
72 # Verify that the Data Reduction Proxy is no longer bypassed 5 minutes
73 # after the original bypass was triggered.
74 time.sleep(60 * 4 + 30)
75 test_driver.LoadURL('http://check.googlezip.net/test.html')
76 responses = test_driver.GetHTTPResponses()
77 self.assertNotEqual(0, len(responses))
78 for response in responses:
79 self.assertHasChromeProxyViaHeader(response)
80
81
82 if __name__ == '__main__':
83 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