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

Side by Side Diff: tools/chrome_proxy/webdriver/lite_page.py

Issue 2910783002: Adds Lo-Fi fallback support for new Data Reduction Proxy protocol. (Closed)
Patch Set: Added integration test the excercises page-polices fallback Created 3 years, 6 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
OLDNEW
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 'document.body.scrollHeight') 90 'document.body.scrollHeight')
91 self.assertGreater(new_scroll_height, original_scroll_height) 91 self.assertGreater(new_scroll_height, original_scroll_height)
92 92
93 # Make sure there were more requests that were proxied. 93 # Make sure there were more requests that were proxied.
94 responses = test_driver.GetHTTPResponses(override_has_logs=True) 94 responses = test_driver.GetHTTPResponses(override_has_logs=True)
95 self.assertNotEqual(0, len(responses)) 95 self.assertNotEqual(0, len(responses))
96 for response in responses: 96 for response in responses:
97 self.assertHasChromeProxyViaHeader(response) 97 self.assertHasChromeProxyViaHeader(response)
98 self.assertIn(response.status, [200, 204]) 98 self.assertIn(response.status, [200, 204])
99 99
100 # Lo-Fi fallback is not currently supported via the client. Check that 100 # Lo-Fi fallback is not currently supported via the client. Check that
megjablon 2017/06/05 23:47:59 Update this to "Lo-Fi fallback is not supported wi
dougarnett 2017/06/06 16:49:47 Done.
101 # no Lo-Fi response is received if a Lite Page is not served. 101 # no Lo-Fi response is received if a Lite Page is not served.
102 def testLitePageFallback(self): 102 def testLitePageNoFallback(self):
103 with TestDriver() as test_driver: 103 with TestDriver() as test_driver:
104 test_driver.AddChromeArg('--enable-spdy-proxy-auth') 104 test_driver.AddChromeArg('--enable-spdy-proxy-auth')
105 test_driver.AddChromeArg('--force-fieldtrials=' 105 test_driver.AddChromeArg('--force-fieldtrials='
106 'DataCompressionProxyLoFi/Enabled_Preview/') 106 'DataCompressionProxyLoFi/Enabled_Preview/')
107 test_driver.AddChromeArg('--force-fieldtrial-params=' 107 test_driver.AddChromeArg('--force-fieldtrial-params='
108 'DataCompressionProxyLoFi.Enabled_Preview:' 108 'DataCompressionProxyLoFi.Enabled_Preview:'
109 'effective_connection_type/4G') 109 'effective_connection_type/4G')
110 test_driver.AddChromeArg('--force-net-effective-connection-type=2g') 110 test_driver.AddChromeArg('--force-net-effective-connection-type=2g')
111 111
112 test_driver.LoadURL('http://check.googlezip.net/lite-page-fallback') 112 test_driver.LoadURL('http://check.googlezip.net/lite-page-fallback')
(...skipping 14 matching lines...) Expand all
127 if not response.url.endswith('png'): 127 if not response.url.endswith('png'):
128 continue 128 continue
129 129
130 # Lo-Fi fallback is not currently supported via the client. Check that 130 # Lo-Fi fallback is not currently supported via the client. Check that
131 # no Lo-Fi response is received. 131 # no Lo-Fi response is received.
132 self.checkLoFiResponse(response, False) 132 self.checkLoFiResponse(response, False)
133 133
134 # Verify that a Lite Page was requested. 134 # Verify that a Lite Page was requested.
135 self.assertEqual(1, lite_page_requests) 135 self.assertEqual(1, lite_page_requests)
136 136
137 # Verifies Lo-Fi fallback via the page-policies server directive.
138 # Note: this test is for the CPAT protocol change in M-61.
139 def testLitePageFallbackViaPagePolicies(self):
megjablon 2017/06/05 23:47:59 Please also add tests with DataReductionProxyDecid
dougarnett 2017/06/06 16:49:46 In different CL? I don't see how these tests would
dougarnett 2017/06/07 16:57:49 I went ahead and added my integration tests here f
140 with TestDriver() as test_driver:
141 test_driver.AddChromeArg('--enable-spdy-proxy-auth')
142 test_driver.AddChromeArg('--enable-features='
143 'DataReductionProxyDecidesTransform')
144 test_driver.AddChromeArg('--force-fieldtrial-params='
145 'NetworkQualityEstimator.Enabled:'
146 'force_effective_connection_type/Slow2G,'
147 'DataCompressionProxyLoFi.Enabled_Preview:'
148 'effective_connection_type/2G')
149 test_driver.AddChromeArg('--force-fieldtrials='
150 'NetworkQualityEstimator/Enabled/'
151 'DataCompressionProxyLoFi/Enabled_Preview')
152
153 test_driver.LoadURL('http://check.googlezip.net/lite-page-fallback')
154
155 lite_page_responses = 0
156 lofi_resource = 0
157 for response in test_driver.GetHTTPResponses():
158 self.assertEqual('Slow-2G',
159 response.request_headers['chrome-proxy-ect'])
160
161 if response.url.endswith('html'):
162 # Verify that the server provides the fallback directive
163 self.assertIn('page-policies=empty-image',
164 response.response_headers['chrome-proxy'])
165 # Main resource should not accept and transform to lite page.
166 if self.checkLitePageResponse(response):
167 lite_page_responses = lite_page_responses + 1
168 if response.url.endswith('png'):
169 if self.checkLoFiResponse(response, True):
170 lofi_resource = lofi_resource + 1
171
172 self.assertEqual(0, lite_page_responses)
173 self.assertNotEqual(0, lofi_resource)
174
137 if __name__ == '__main__': 175 if __name__ == '__main__':
138 IntegrationTest.RunAllTests() 176 IntegrationTest.RunAllTests()
OLDNEW
« content/renderer/previews_state_helper_unittest.cc ('K') | « content/test/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698