OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 base64 | 5 import base64 |
6 import logging | 6 import logging |
7 import urlparse | 7 import urlparse |
8 | 8 |
9 from common import chrome_proxy_measurements as measurements | 9 from common import chrome_proxy_measurements as measurements |
10 from common.chrome_proxy_measurements import ChromeProxyValidation | 10 from common.chrome_proxy_measurements import ChromeProxyValidation |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 def __init__(self): | 186 def __init__(self): |
187 super(ChromeProxyHTTPFallbackViaHeader, self).__init__( | 187 super(ChromeProxyHTTPFallbackViaHeader, self).__init__( |
188 restart_after_each_page=True, | 188 restart_after_each_page=True, |
189 metrics=metrics.ChromeProxyMetric()) | 189 metrics=metrics.ChromeProxyMetric()) |
190 | 190 |
191 def CustomizeBrowserOptions(self, options): | 191 def CustomizeBrowserOptions(self, options): |
192 super(ChromeProxyHTTPFallbackViaHeader, | 192 super(ChromeProxyHTTPFallbackViaHeader, |
193 self).CustomizeBrowserOptions(options) | 193 self).CustomizeBrowserOptions(options) |
194 options.AppendExtraBrowserArgs('--ignore-certificate-errors') | 194 options.AppendExtraBrowserArgs('--ignore-certificate-errors') |
| 195 # Set the primary Data Reduction Proxy to be the test server. The test |
| 196 # doesn't know if Chrome is configuring the DRP using the Data Saver API or |
| 197 # not, so the appropriate flags are set for both cases. |
195 options.AppendExtraBrowserArgs( | 198 options.AppendExtraBrowserArgs( |
196 '--spdy-proxy-auth-origin=http://%s' % _TEST_SERVER) | 199 '--spdy-proxy-auth-origin=http://%s' % _TEST_SERVER) |
| 200 options.AppendExtraBrowserArgs( |
| 201 '--data-reduction-proxy-http-proxies=' |
| 202 'http://%s;http://compress.googlezip.net' % _TEST_SERVER) |
197 | 203 |
198 def AddResults(self, tab, results): | 204 def AddResults(self, tab, results): |
199 self._metrics.AddResultsForHTTPFallback(tab, results) | 205 self._metrics.AddResultsForHTTPFallback(tab, results) |
200 | 206 |
201 | 207 |
202 class ChromeProxyClientVersion(ChromeProxyValidation): | 208 class ChromeProxyClientVersion(ChromeProxyValidation): |
203 """Correctness measurement for version directives in Chrome-Proxy header. | 209 """Correctness measurement for version directives in Chrome-Proxy header. |
204 | 210 |
205 The test verifies that the version information provided in the Chrome-Proxy | 211 The test verifies that the version information provided in the Chrome-Proxy |
206 request header overrides any version, if specified, that is provided in the | 212 request header overrides any version, if specified, that is provided in the |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 | 306 |
301 def __init__(self): | 307 def __init__(self): |
302 super(ChromeProxyHTTPToDirectFallback, self).__init__( | 308 super(ChromeProxyHTTPToDirectFallback, self).__init__( |
303 restart_after_each_page=True, | 309 restart_after_each_page=True, |
304 metrics=metrics.ChromeProxyMetric()) | 310 metrics=metrics.ChromeProxyMetric()) |
305 | 311 |
306 def CustomizeBrowserOptions(self, options): | 312 def CustomizeBrowserOptions(self, options): |
307 super(ChromeProxyHTTPToDirectFallback, | 313 super(ChromeProxyHTTPToDirectFallback, |
308 self).CustomizeBrowserOptions(options) | 314 self).CustomizeBrowserOptions(options) |
309 # Set the primary proxy to something that will fail to be resolved so that | 315 # Set the primary proxy to something that will fail to be resolved so that |
310 # this test will run using the HTTP fallback proxy. | 316 # this test will run using the HTTP fallback proxy. The test doesn't know if |
| 317 # Chrome is configuring the DRP using the Data Saver API or not, so the |
| 318 # appropriate flags are set for both cases. |
311 options.AppendExtraBrowserArgs( | 319 options.AppendExtraBrowserArgs( |
312 '--spdy-proxy-auth-origin=http://nonexistent.googlezip.net') | 320 '--spdy-proxy-auth-origin=http://nonexistent.googlezip.net') |
| 321 options.AppendExtraBrowserArgs( |
| 322 '--data-reduction-proxy-http-proxies=' |
| 323 'http://nonexistent.googlezip.net;http://compress.googlezip.net') |
313 | 324 |
314 def WillNavigateToPage(self, page, tab): | 325 def WillNavigateToPage(self, page, tab): |
315 super(ChromeProxyHTTPToDirectFallback, self).WillNavigateToPage(page, tab) | 326 super(ChromeProxyHTTPToDirectFallback, self).WillNavigateToPage(page, tab) |
316 # Attempt to load a page through the nonexistent primary proxy in order to | 327 # Attempt to load a page through the nonexistent primary proxy in order to |
317 # cause a proxy fallback, and have this test run starting from the HTTP | 328 # cause a proxy fallback, and have this test run starting from the HTTP |
318 # fallback proxy. | 329 # fallback proxy. |
319 tab.Navigate(_TEST_SERVER_DEFAULT_URL) | 330 tab.Navigate(_TEST_SERVER_DEFAULT_URL) |
320 tab.WaitForJavaScriptExpression('performance.timing.loadEventStart', 300) | 331 tab.WaitForJavaScriptExpression('performance.timing.loadEventStart', 300) |
321 | 332 |
322 def AddResults(self, tab, results): | 333 def AddResults(self, tab, results): |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth') | 504 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth') |
494 | 505 |
495 def WillNavigateToPage(self, page, tab): | 506 def WillNavigateToPage(self, page, tab): |
496 measurements.WaitForViaHeader(tab) | 507 measurements.WaitForViaHeader(tab) |
497 tab.ClearCache(force=True) | 508 tab.ClearCache(force=True) |
498 self._metrics.Start(page, tab) | 509 self._metrics.Start(page, tab) |
499 | 510 |
500 def ValidateAndMeasurePage(self, page, tab, results): | 511 def ValidateAndMeasurePage(self, page, tab, results): |
501 self._metrics.Stop(page, tab) | 512 self._metrics.Stop(page, tab) |
502 self._metrics.AddResults(tab, results) | 513 self._metrics.AddResults(tab, results) |
OLD | NEW |