| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 options.AppendExtraBrowserArgs( | 234 options.AppendExtraBrowserArgs( |
| 235 '--spdy-proxy-auth-origin=http://%s' % _TEST_SERVER) | 235 '--spdy-proxy-auth-origin=http://%s' % _TEST_SERVER) |
| 236 options.AppendExtraBrowserArgs( | 236 options.AppendExtraBrowserArgs( |
| 237 '--data-reduction-proxy-http-proxies=' | 237 '--data-reduction-proxy-http-proxies=' |
| 238 'http://%s;http://compress.googlezip.net' % _TEST_SERVER) | 238 'http://%s;http://compress.googlezip.net' % _TEST_SERVER) |
| 239 | 239 |
| 240 def AddResults(self, tab, results): | 240 def AddResults(self, tab, results): |
| 241 self._metrics.AddResultsForHTTPFallback(tab, results) | 241 self._metrics.AddResultsForHTTPFallback(tab, results) |
| 242 | 242 |
| 243 | 243 |
| 244 class ChromeProxyClientVersion(ChromeProxyValidation): | |
| 245 """Correctness measurement for version directives in Chrome-Proxy header. | |
| 246 | |
| 247 The test verifies that the version information provided in the Chrome-Proxy | |
| 248 request header overrides any version, if specified, that is provided in the | |
| 249 user agent string. | |
| 250 """ | |
| 251 | |
| 252 def __init__(self): | |
| 253 super(ChromeProxyClientVersion, self).__init__( | |
| 254 metrics=metrics.ChromeProxyMetric()) | |
| 255 | |
| 256 def CustomizeBrowserOptions(self, options): | |
| 257 super(ChromeProxyClientVersion, | |
| 258 self).CustomizeBrowserOptions(options) | |
| 259 options.AppendExtraBrowserArgs('--user-agent="Chrome/32.0.1700.99"') | |
| 260 | |
| 261 def AddResults(self, tab, results): | |
| 262 self._metrics.AddResultsForClientVersion(tab, results) | |
| 263 | |
| 264 | |
| 265 class ChromeProxyClientType(ChromeProxyValidation): | 244 class ChromeProxyClientType(ChromeProxyValidation): |
| 266 """Correctness measurement for Chrome-Proxy header client type directives.""" | 245 """Correctness measurement for Chrome-Proxy header client type directives.""" |
| 267 | 246 |
| 268 def __init__(self): | 247 def __init__(self): |
| 269 super(ChromeProxyClientType, self).__init__( | 248 super(ChromeProxyClientType, self).__init__( |
| 270 restart_after_each_page=True, | 249 restart_after_each_page=True, |
| 271 metrics=metrics.ChromeProxyMetric()) | 250 metrics=metrics.ChromeProxyMetric()) |
| 272 self._chrome_proxy_client_type = None | 251 self._chrome_proxy_client_type = None |
| 273 | 252 |
| 274 def AddResults(self, tab, results): | 253 def AddResults(self, tab, results): |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth') | 554 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth') |
| 576 | 555 |
| 577 def WillNavigateToPage(self, page, tab): | 556 def WillNavigateToPage(self, page, tab): |
| 578 measurements.WaitForViaHeader(tab) | 557 measurements.WaitForViaHeader(tab) |
| 579 tab.ClearCache(force=True) | 558 tab.ClearCache(force=True) |
| 580 self._metrics.Start(page, tab) | 559 self._metrics.Start(page, tab) |
| 581 | 560 |
| 582 def ValidateAndMeasurePage(self, page, tab, results): | 561 def ValidateAndMeasurePage(self, page, tab, results): |
| 583 self._metrics.Stop(page, tab) | 562 self._metrics.Stop(page, tab) |
| 584 self._metrics.AddResults(tab, results) | 563 self._metrics.AddResults(tab, results) |
| OLD | NEW |