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.chrome_proxy_measurements import ChromeProxyValidation | 9 from common.chrome_proxy_measurements import ChromeProxyValidation |
10 from integration_tests import chrome_proxy_metrics as metrics | 10 from integration_tests import chrome_proxy_metrics as metrics |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 restart_after_each_page=True, | 267 restart_after_each_page=True, |
268 metrics=metrics.ChromeProxyMetric()) | 268 metrics=metrics.ChromeProxyMetric()) |
269 | 269 |
270 def CustomizeBrowserOptions(self, options): | 270 def CustomizeBrowserOptions(self, options): |
271 super(ChromeProxyExpDirective, self).CustomizeBrowserOptions(options) | 271 super(ChromeProxyExpDirective, self).CustomizeBrowserOptions(options) |
272 options.AppendExtraBrowserArgs('--data-reduction-proxy-experiment=test') | 272 options.AppendExtraBrowserArgs('--data-reduction-proxy-experiment=test') |
273 | 273 |
274 def AddResults(self, tab, results): | 274 def AddResults(self, tab, results): |
275 self._metrics.AddResultsForBypass(tab, results, url_pattern='/exptest/') | 275 self._metrics.AddResultsForBypass(tab, results, url_pattern='/exptest/') |
276 | 276 |
| 277 class ChromeProxyPassThrough(ChromeProxyValidation): |
| 278 """Correctness measurement for Chrome-Proxy pass-through directives. |
| 279 |
| 280 This test verifies that "pass-through" in the Chrome-Proxy request header |
| 281 causes a resource to be loaded without Data Reduction Proxy transformations. |
| 282 """ |
| 283 |
| 284 def __init__(self): |
| 285 super(ChromeProxyPassThrough, self).__init__( |
| 286 restart_after_each_page=True, |
| 287 metrics=metrics.ChromeProxyMetric()) |
| 288 |
| 289 def CustomizeBrowserOptions(self, options): |
| 290 super(ChromeProxyPassThrough, self).CustomizeBrowserOptions(options) |
| 291 |
| 292 def AddResults(self, tab, results): |
| 293 self._metrics.AddResultsForPassThrough(tab, results) |
277 | 294 |
278 class ChromeProxyHTTPToDirectFallback(ChromeProxyValidation): | 295 class ChromeProxyHTTPToDirectFallback(ChromeProxyValidation): |
279 """Correctness measurement for HTTP proxy fallback to direct.""" | 296 """Correctness measurement for HTTP proxy fallback to direct.""" |
280 | 297 |
281 def __init__(self): | 298 def __init__(self): |
282 super(ChromeProxyHTTPToDirectFallback, self).__init__( | 299 super(ChromeProxyHTTPToDirectFallback, self).__init__( |
283 restart_after_each_page=True, | 300 restart_after_each_page=True, |
284 metrics=metrics.ChromeProxyMetric()) | 301 metrics=metrics.ChromeProxyMetric()) |
285 | 302 |
286 def CustomizeBrowserOptions(self, options): | 303 def CustomizeBrowserOptions(self, options): |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 if pm[x] != dm[x]: | 455 if pm[x] != dm[x]: |
439 err('Mismatch for %s (proxied=%s direct=%s): %s' % | 456 err('Mismatch for %s (proxied=%s direct=%s): %s' % |
440 (x, str(pm[x]), str(dm[x]), page.url)) | 457 (x, str(pm[x]), str(dm[x]), page.url)) |
441 | 458 |
442 # Proxied XOCL should match direct CL. | 459 # Proxied XOCL should match direct CL. |
443 pxocl = pm['x_original_content_length_header'] | 460 pxocl = pm['x_original_content_length_header'] |
444 dcl = dm['content_length_header'] | 461 dcl = dm['content_length_header'] |
445 if pxocl != dcl: | 462 if pxocl != dcl: |
446 err('Mismatch for content length (proxied=%s direct=%s): %s' % | 463 err('Mismatch for content length (proxied=%s direct=%s): %s' % |
447 (str(pxocl), str(dcl), page.url)) | 464 (str(pxocl), str(dcl), page.url)) |
OLD | NEW |