| OLD | NEW | 
|---|
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be | 
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. | 
| 4 | 4 | 
| 5 import common | 5 import common | 
| 6 from common import TestDriver | 6 from common import TestDriver | 
| 7 from common import IntegrationTest | 7 from common import IntegrationTest | 
|  | 8 from decorators import ChromeVersionBeforeM | 
| 8 | 9 | 
| 9 | 10 | 
| 10 class LoFi(IntegrationTest): | 11 class LoFi(IntegrationTest): | 
| 11 | 12 | 
| 12   #  Checks that the compressed image is below a certain threshold. | 13   #  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   #  The test page is uncacheable otherwise a cached page may be served that | 
| 14   #  doesn't have the correct via headers. | 15   #  doesn't have the correct via headers. | 
| 15   def testLoFi(self): | 16   def testLoFi(self): | 
| 16     with TestDriver() as test_driver: | 17     with TestDriver() as test_driver: | 
| 17       test_driver.AddChromeArg('--enable-spdy-proxy-auth') | 18       test_driver.AddChromeArg('--enable-spdy-proxy-auth') | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 61           continue | 62           continue | 
| 62         if (self.checkLoFiResponse(response, True)): | 63         if (self.checkLoFiResponse(response, True)): | 
| 63           lofi_responses = lofi_responses + 1 | 64           lofi_responses = lofi_responses + 1 | 
| 64 | 65 | 
| 65       # Verify that Lo-Fi responses were seen. | 66       # Verify that Lo-Fi responses were seen. | 
| 66       self.assertNotEqual(0, lofi_responses) | 67       self.assertNotEqual(0, lofi_responses) | 
| 67 | 68 | 
| 68   # Checks that LoFi images are not served, but the if-heavy CPAT header is | 69   # Checks that LoFi images are not served, but the if-heavy CPAT header is | 
| 69   # added when LoFi slow connections are used and the network quality estimator | 70   # added when LoFi slow connections are used and the network quality estimator | 
| 70   # returns 4G. | 71   # returns 4G. | 
|  | 72   # If-heavy stopped being added in M61. | 
|  | 73   @ChromeVersionBeforeM(61) | 
| 71   def testLoFiIfHeavyFastConnection(self): | 74   def testLoFiIfHeavyFastConnection(self): | 
| 72     with TestDriver() as test_driver: | 75     with TestDriver() as test_driver: | 
| 73       test_driver.AddChromeArg('--enable-spdy-proxy-auth') | 76       test_driver.AddChromeArg('--enable-spdy-proxy-auth') | 
| 74       test_driver.AddChromeArg('--data-reduction-proxy-lo-fi=slow-connections-' | 77       test_driver.AddChromeArg('--data-reduction-proxy-lo-fi=slow-connections-' | 
| 75                                'only') | 78                                'only') | 
| 76       # Disable server experiments. | 79       # Disable server experiments. | 
| 77       test_driver.AddChromeArg('--data-reduction-proxy-server-experiments-' | 80       test_driver.AddChromeArg('--data-reduction-proxy-server-experiments-' | 
| 78                                'disabled') | 81                                'disabled') | 
| 79 | 82 | 
| 80       test_driver.AddChromeArg('--force-fieldtrial-params=' | 83       test_driver.AddChromeArg('--force-fieldtrial-params=' | 
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 175           continue | 178           continue | 
| 176         responses = responses + 1 | 179         responses = responses + 1 | 
| 177         self.assertHasChromeProxyViaHeader(response) | 180         self.assertHasChromeProxyViaHeader(response) | 
| 178         self.checkLoFiResponse(response, False) | 181         self.checkLoFiResponse(response, False) | 
| 179 | 182 | 
| 180       # Verify that responses were seen. | 183       # Verify that responses were seen. | 
| 181       self.assertNotEqual(0, responses) | 184       self.assertNotEqual(0, responses) | 
| 182 | 185 | 
| 183 if __name__ == '__main__': | 186 if __name__ == '__main__': | 
| 184   IntegrationTest.RunAllTests() | 187   IntegrationTest.RunAllTests() | 
| OLD | NEW | 
|---|