| 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 import time | 9 import time |
| 10 | 10 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 self.assertGreater(new_scroll_height, original_scroll_height) | 82 self.assertGreater(new_scroll_height, original_scroll_height) |
| 83 | 83 |
| 84 # Make sure there were more requests that were proxied. | 84 # Make sure there were more requests that were proxied. |
| 85 responses = test_driver.GetHTTPResponses(override_has_logs=True) | 85 responses = test_driver.GetHTTPResponses(override_has_logs=True) |
| 86 self.assertNotEqual(0, len(responses)) | 86 self.assertNotEqual(0, len(responses)) |
| 87 for response in responses: | 87 for response in responses: |
| 88 self.assertHasChromeProxyViaHeader(response) | 88 self.assertHasChromeProxyViaHeader(response) |
| 89 self.assertIn(response.status, [200, 204]) | 89 self.assertIn(response.status, [200, 204]) |
| 90 | 90 |
| 91 # Lo-Fi fallback is not currently supported via the client. Check that | 91 # Lo-Fi fallback is not currently supported via the client. Check that |
| 92 # no Lo-Fi response is received if the user is in the | 92 # no Lo-Fi response is received if a Lite Page is not served. |
| 93 # DataCompressionProxyLitePageFallback field trial and a Lite Page is not | |
| 94 # served. | |
| 95 def testLitePageFallback(self): | 93 def testLitePageFallback(self): |
| 96 with TestDriver() as test_driver: | 94 with TestDriver() as test_driver: |
| 97 test_driver.AddChromeArg('--enable-spdy-proxy-auth') | 95 test_driver.AddChromeArg('--enable-spdy-proxy-auth') |
| 98 test_driver.AddChromeArg('--force-fieldtrials=' | 96 test_driver.AddChromeArg('--force-fieldtrials=' |
| 99 'DataCompressionProxyLoFi/Enabled_Preview/' | 97 'DataCompressionProxyLoFi/Enabled_Preview/') |
| 100 'DataCompressionProxyLitePageFallback/Enabled') | |
| 101 test_driver.AddChromeArg('--force-fieldtrial-params=' | 98 test_driver.AddChromeArg('--force-fieldtrial-params=' |
| 102 'DataCompressionProxyLoFi.Enabled_Preview:' | 99 'DataCompressionProxyLoFi.Enabled_Preview:' |
| 103 'effective_connection_type/4G') | 100 'effective_connection_type/4G') |
| 104 test_driver.AddChromeArg('--force-net-effective-connection-type=2g') | 101 test_driver.AddChromeArg('--force-net-effective-connection-type=2g') |
| 105 | 102 |
| 106 test_driver.LoadURL('http://check.googlezip.net/lite-page-fallback') | 103 test_driver.LoadURL('http://check.googlezip.net/lite-page-fallback') |
| 107 | 104 |
| 108 lite_page_requests = 0 | 105 lite_page_requests = 0 |
| 109 lo_fi_responses = 0 | 106 lo_fi_responses = 0 |
| 110 for response in test_driver.GetHTTPResponses(): | 107 for response in test_driver.GetHTTPResponses(): |
| (...skipping 12 matching lines...) Expand all Loading... |
| 123 | 120 |
| 124 # Lo-Fi fallback is not currently supported via the client. Check that | 121 # Lo-Fi fallback is not currently supported via the client. Check that |
| 125 # no Lo-Fi response is received. | 122 # no Lo-Fi response is received. |
| 126 self.checkLoFiResponse(response, False) | 123 self.checkLoFiResponse(response, False) |
| 127 | 124 |
| 128 # Verify that a Lite Page was requested. | 125 # Verify that a Lite Page was requested. |
| 129 self.assertEqual(1, lite_page_requests) | 126 self.assertEqual(1, lite_page_requests) |
| 130 | 127 |
| 131 if __name__ == '__main__': | 128 if __name__ == '__main__': |
| 132 IntegrationTest.RunAllTests() | 129 IntegrationTest.RunAllTests() |
| OLD | NEW |