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 common | |
6 from common import TestDriver | |
7 from common import IntegrationTest | |
8 | |
9 | |
10 class Bypass(IntegrationTest): | |
Robert Ogden
2017/02/23 21:56:24
Maybe LoFi or something besides Bypass
megjablon
2017/02/23 22:19:19
Just caught that when working on other tests and t
| |
11 | |
12 # Checks that the compressed image is below a certain threshold. | |
13 # The test page is uncacheable otherwise a cached page may be served that | |
14 # doesn't have the correct via headers. | |
15 def testLoFi(self): | |
16 with TestDriver() as test_driver: | |
17 test_driver.AddChromeArg('--enable-spdy-proxy-auth') | |
18 test_driver.AddChromeArg('--data-reduction-proxy-lo-fi=always-on') | |
19 # Disable server experiments such as tamper detection. | |
20 test_driver.AddChromeArg('--data-reduction-proxy-server-experiments-' | |
21 'disabled') | |
22 test_driver.AddChromeArg('--disable-quic') | |
23 | |
24 test_driver.LoadURL('http://check.googlezip.net/static/index.html') | |
25 | |
26 lofi_responses = 0 | |
27 for response in test_driver.GetHTTPResponses(): | |
28 if not response.url.endswith('png'): | |
29 continue | |
30 if not response.request_headers: | |
31 continue | |
32 self.assertHasChromeProxyViaHeader(response) | |
33 content_length = response.response_headers['content-length'] | |
34 cpat_request = response.request_headers['chrome-proxy-accept-transform'] | |
35 cpct_response = response.response_headers[ | |
36 'chrome-proxy-content-transform'] | |
37 if ('empty-image' in cpct_response): | |
38 lofi_responses = lofi_responses + 1 | |
39 self.assertTrue('empty-image' in cpat_request) | |
40 self.assertTrue(int(content_length) < 100) | |
41 | |
42 # Verify that Lo-Fi responses were seen. | |
43 self.assertNotEqual(0, lofi_responses) | |
44 | |
45 if __name__ == '__main__': | |
46 IntegrationTest.RunAllTests() | |
OLD | NEW |