| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 queries.append('respBody=%s' % base64.b64encode(respBody)) | 188 queries.append('respBody=%s' % base64.b64encode(respBody)) |
| 189 if len(queries) == 0: | 189 if len(queries) == 0: |
| 190 return url | 190 return url |
| 191 "&".join(queries) | 191 "&".join(queries) |
| 192 # url has query already | 192 # url has query already |
| 193 if urlparse.urlparse(url).query: | 193 if urlparse.urlparse(url).query: |
| 194 return url + '&' + "&".join(queries) | 194 return url + '&' + "&".join(queries) |
| 195 else: | 195 else: |
| 196 return url + '?' + "&".join(queries) | 196 return url + '?' + "&".join(queries) |
| 197 | 197 |
| 198 class ChromeProxyBadHTTPSFallback(ChromeProxyValidation): |
| 199 """Checks the client falls back to HTTP proxy when HTTPS proxy errors.""" |
| 200 |
| 201 def __init__(self): |
| 202 super(ChromeProxyBadHTTPSFallback, self).__init__( |
| 203 restart_after_each_page=True, |
| 204 metrics=metrics.ChromeProxyMetric()) |
| 205 self._is_chrome_proxy_enabled = True |
| 206 |
| 207 def CustomizeBrowserOptions(self, options): |
| 208 super(ChromeProxyBadHTTPSFallback, self).CustomizeBrowserOptions( |
| 209 options) |
| 210 |
| 211 def AddResults(self, tab, results): |
| 212 self._metrics.AddResultsForBadHTTPSFallback(tab, results) |
| 198 | 213 |
| 199 class ChromeProxyHTTPFallbackProbeURL(ChromeProxyValidation): | 214 class ChromeProxyHTTPFallbackProbeURL(ChromeProxyValidation): |
| 200 """Correctness measurement for proxy fallback. | 215 """Correctness measurement for proxy fallback. |
| 201 | 216 |
| 202 In this test, the probe URL does not return 'OK'. Chrome is expected | 217 In this test, the probe URL does not return 'OK'. Chrome is expected |
| 203 to use the fallback proxy. | 218 to use the fallback proxy. |
| 204 """ | 219 """ |
| 205 | 220 |
| 206 def __init__(self): | 221 def __init__(self): |
| 207 super(ChromeProxyHTTPFallbackProbeURL, self).__init__( | 222 super(ChromeProxyHTTPFallbackProbeURL, self).__init__( |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 | 700 |
| 686 def CustomizeBrowserOptions(self, options): | 701 def CustomizeBrowserOptions(self, options): |
| 687 super(ChromeProxyPingback, self).CustomizeBrowserOptions(options) | 702 super(ChromeProxyPingback, self).CustomizeBrowserOptions(options) |
| 688 options.AppendExtraBrowserArgs( | 703 options.AppendExtraBrowserArgs( |
| 689 '--enable-data-reduction-proxy-force-pingback') | 704 '--enable-data-reduction-proxy-force-pingback') |
| 690 options.AppendExtraBrowserArgs( | 705 options.AppendExtraBrowserArgs( |
| 691 '--enable-stats-collection-bindings') | 706 '--enable-stats-collection-bindings') |
| 692 | 707 |
| 693 def AddResults(self, tab, results): | 708 def AddResults(self, tab, results): |
| 694 self._metrics.AddResultsForPingback(tab, results) | 709 self._metrics.AddResultsForPingback(tab, results) |
| OLD | NEW |