Chromium Code Reviews| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 queries.append('respBody=%s' % base64.b64encode(respBody)) | 174 queries.append('respBody=%s' % base64.b64encode(respBody)) |
| 175 if len(queries) == 0: | 175 if len(queries) == 0: |
| 176 return url | 176 return url |
| 177 "&".join(queries) | 177 "&".join(queries) |
| 178 # url has query already | 178 # url has query already |
| 179 if urlparse.urlparse(url).query: | 179 if urlparse.urlparse(url).query: |
| 180 return url + '&' + "&".join(queries) | 180 return url + '&' + "&".join(queries) |
| 181 else: | 181 else: |
| 182 return url + '?' + "&".join(queries) | 182 return url + '?' + "&".join(queries) |
| 183 | 183 |
| 184 class ChromeProxyBadHTTPSFallback(ChromeProxyValidation): | |
| 185 """Checks the client falls back to HTTP proxy when HTTPS proxy errors.""" | |
| 186 | |
| 187 def __init__(self): | |
| 188 super(ChromeProxyBadHTTPSFallback, self).__init__( | |
| 189 restart_after_each_page=True, | |
| 190 metrics=metrics.ChromeProxyMetric()) | |
| 191 self._is_chrome_proxy_enabled = True | |
| 192 | |
| 193 def CustomizeBrowserOptions(self, options): | |
| 194 super(ChromeProxyBadHTTPSFallback, self).CustomizeBrowserOptions( | |
| 195 options) | |
| 196 options.AppendExtraBrowserArgs('--data-reduction-proxy-http-proxies=' | |
| 197 'https://%s;http://compress.googlezip.net' % _TEST_SERVER) | |
|
bustamante
2016/08/12 20:01:57
In some cases we'll want to set the proxy to an in
Robert Ogden
2016/08/15 17:13:14
Yes, and it can be overridden from the command lin
| |
| 198 | |
| 199 def AddResults(self, tab, results): | |
| 200 self._metrics.AddResultsForBadHTTPSFallback(tab, results) | |
| 184 | 201 |
| 185 class ChromeProxyHTTPFallbackProbeURL(ChromeProxyValidation): | 202 class ChromeProxyHTTPFallbackProbeURL(ChromeProxyValidation): |
| 186 """Correctness measurement for proxy fallback. | 203 """Correctness measurement for proxy fallback. |
| 187 | 204 |
| 188 In this test, the probe URL does not return 'OK'. Chrome is expected | 205 In this test, the probe URL does not return 'OK'. Chrome is expected |
| 189 to use the fallback proxy. | 206 to use the fallback proxy. |
| 190 """ | 207 """ |
| 191 | 208 |
| 192 def __init__(self): | 209 def __init__(self): |
| 193 super(ChromeProxyHTTPFallbackProbeURL, self).__init__( | 210 super(ChromeProxyHTTPFallbackProbeURL, self).__init__( |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 670 metrics=metrics.ChromeProxyMetric()) | 687 metrics=metrics.ChromeProxyMetric()) |
| 671 | 688 |
| 672 def CustomizeBrowserOptions(self, options): | 689 def CustomizeBrowserOptions(self, options): |
| 673 super(ChromeProxyPingback, self).CustomizeBrowserOptions(options) | 690 super(ChromeProxyPingback, self).CustomizeBrowserOptions(options) |
| 674 options.AppendExtraBrowserArgs( | 691 options.AppendExtraBrowserArgs( |
| 675 '--enable-data-reduction-proxy-force-pingback') | 692 '--enable-data-reduction-proxy-force-pingback') |
| 676 options.AppendExtraBrowserArgs( | 693 options.AppendExtraBrowserArgs( |
| 677 '--enable-stats-collection-bindings') | 694 '--enable-stats-collection-bindings') |
| 678 | 695 |
| 679 def AddResults(self, tab, results): | 696 def AddResults(self, tab, results): |
| 680 self._metrics.AddResultsForPingback(tab, results) | 697 self._metrics.AddResultsForPingback(tab, results) |
| OLD | NEW |