| 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 | 8 |
| 9 | 9 |
| 10 class LoFi(IntegrationTest): | 10 class LoFi(IntegrationTest): |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 # reloads when Lo-Fi mode is disabled or data reduction proxy is disabled. | 38 # reloads when Lo-Fi mode is disabled or data reduction proxy is disabled. |
| 39 # First a test page is opened with Lo-Fi and chrome proxy enabled. This allows | 39 # First a test page is opened with Lo-Fi and chrome proxy enabled. This allows |
| 40 # Chrome to cache the Lo-Fi placeholder image. The browser is restarted with | 40 # Chrome to cache the Lo-Fi placeholder image. The browser is restarted with |
| 41 # chrome proxy disabled and the same test page is loaded. This second page | 41 # chrome proxy disabled and the same test page is loaded. This second page |
| 42 # load should not pick the Lo-Fi placeholder from cache and original image | 42 # load should not pick the Lo-Fi placeholder from cache and original image |
| 43 # should be loaded. Finally, the browser is restarted with chrome proxy | 43 # should be loaded. Finally, the browser is restarted with chrome proxy |
| 44 # enabled and Lo-Fi disabled and the same test page is loaded. This third page | 44 # enabled and Lo-Fi disabled and the same test page is loaded. This third page |
| 45 # load should not pick the Lo-Fi placeholder from cache and original image | 45 # load should not pick the Lo-Fi placeholder from cache and original image |
| 46 # should be loaded. | 46 # should be loaded. |
| 47 def testLoFiCacheBypass(self): | 47 def testLoFiCacheBypass(self): |
| 48 # If it was attempted to run with another experiment, skip this test. |
| 49 if common.ParseFlags().browser_args and ('--data-reduction-proxy-experiment' |
| 50 in common.ParseFlags().browser_args): |
| 51 self.skipTest('This test cannot be run with other experiments.') |
| 48 with TestDriver() as test_driver: | 52 with TestDriver() as test_driver: |
| 49 # First page load, enable Lo-Fi and chrome proxy. Disable server | 53 # First page load, enable Lo-Fi and chrome proxy. Disable server |
| 50 # experiments such as tamper detection. This test should be run with | 54 # experiments such as tamper detection. This test should be run with |
| 51 # --profile-type=default command line for the same user profile and cache | 55 # --profile-type=default command line for the same user profile and cache |
| 52 # to be used across the two page loads. | 56 # to be used across the two page loads. |
| 53 test_driver.AddChromeArg('--enable-spdy-proxy-auth') | 57 test_driver.AddChromeArg('--enable-spdy-proxy-auth') |
| 54 test_driver.AddChromeArg('--data-reduction-proxy-lo-fi=always-on') | 58 test_driver.AddChromeArg('--data-reduction-proxy-lo-fi=always-on') |
| 55 test_driver.AddChromeArg('--profile-type=default') | 59 test_driver.AddChromeArg('--profile-type=default') |
| 56 test_driver.AddChromeArg('--data-reduction-proxy-server-experiments-' | 60 test_driver.AddChromeArg('--data-reduction-proxy-server-experiments-' |
| 57 'disabled') | 61 'disabled') |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 continue | 107 continue |
| 104 responses = responses + 1 | 108 responses = responses + 1 |
| 105 self.assertHasChromeProxyViaHeader(response) | 109 self.assertHasChromeProxyViaHeader(response) |
| 106 self.checkLoFiResponse(response, False) | 110 self.checkLoFiResponse(response, False) |
| 107 | 111 |
| 108 # Verify that responses were seen. | 112 # Verify that responses were seen. |
| 109 self.assertNotEqual(0, responses) | 113 self.assertNotEqual(0, responses) |
| 110 | 114 |
| 111 if __name__ == '__main__': | 115 if __name__ == '__main__': |
| 112 IntegrationTest.RunAllTests() | 116 IntegrationTest.RunAllTests() |
| OLD | NEW |