| 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 integration_tests import chrome_proxy_metrics as metrics | 9 from integration_tests import chrome_proxy_metrics as metrics |
| 10 from metrics import loading | 10 from metrics import loading |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 probe_url = GetResponseOverrideURL( | 176 probe_url = GetResponseOverrideURL( |
| 177 _TEST_SERVER_DEFAULT_URL, | 177 _TEST_SERVER_DEFAULT_URL, |
| 178 respBody='not OK') | 178 respBody='not OK') |
| 179 options.AppendExtraBrowserArgs( | 179 options.AppendExtraBrowserArgs( |
| 180 '--data-reduction-proxy-probe-url=%s' % probe_url) | 180 '--data-reduction-proxy-probe-url=%s' % probe_url) |
| 181 | 181 |
| 182 def AddResults(self, tab, results): | 182 def AddResults(self, tab, results): |
| 183 self._metrics.AddResultsForHTTPFallback(tab, results) | 183 self._metrics.AddResultsForHTTPFallback(tab, results) |
| 184 | 184 |
| 185 | 185 |
| 186 # Depends on the fix of http://crbug.com/330342. | |
| 187 class ChromeProxyHTTPFallbackViaHeader(ChromeProxyValidation): | 186 class ChromeProxyHTTPFallbackViaHeader(ChromeProxyValidation): |
| 188 """Correctness measurement for proxy fallback. | 187 """Correctness measurement for proxy fallback. |
| 189 | 188 |
| 190 In this test, the configured proxy is the chromeproxy-test server which | 189 In this test, the configured proxy is the chromeproxy-test server which |
| 191 will send back a response without the expected Via header. Chrome is | 190 will send back a response without the expected Via header. Chrome is |
| 192 expected to use the fallback proxy and add the configured proxy to the | 191 expected to use the fallback proxy and add the configured proxy to the |
| 193 bad proxy list. | 192 bad proxy list. |
| 194 """ | 193 """ |
| 195 | 194 |
| 196 def __init__(self): | 195 def __init__(self): |
| 197 super(ChromeProxyHTTPFallbackViaHeader, self).__init__() | 196 super(ChromeProxyHTTPFallbackViaHeader, self).__init__() |
| 198 | 197 |
| 199 def CustomizeBrowserOptions(self, options): | 198 def CustomizeBrowserOptions(self, options): |
| 200 super(ChromeProxyHTTPFallbackViaHeader, | 199 super(ChromeProxyHTTPFallbackViaHeader, |
| 201 self).CustomizeBrowserOptions(options) | 200 self).CustomizeBrowserOptions(options) |
| 202 options.AppendExtraBrowserArgs('--ignore-certificate-errors') | 201 options.AppendExtraBrowserArgs('--ignore-certificate-errors') |
| 203 options.AppendExtraBrowserArgs( | 202 options.AppendExtraBrowserArgs( |
| 204 '--spdy-proxy-auth-origin=http://%s' % _TEST_SERVER) | 203 '--spdy-proxy-auth-origin=http://%s' % _TEST_SERVER) |
| 205 options.AppendExtraBrowserArgs( | 204 options.AppendExtraBrowserArgs( |
| 206 '--spdy-proxy-auth-value=%s' % _FAKE_PROXY_AUTH_VALUE) | 205 '--spdy-proxy-auth-value=%s' % _FAKE_PROXY_AUTH_VALUE) |
| 207 | 206 |
| 208 def AddResults(self, tab, results): | 207 def AddResults(self, tab, results): |
| 209 proxies = [ | 208 proxies = [ |
| 210 _TEST_SERVER + ":80", | 209 _TEST_SERVER + ":80", |
| 211 self._metrics.effective_proxies['fallback'], | 210 self._metrics.effective_proxies['fallback'], |
| 212 self._metrics.effective_proxies['direct']] | 211 self._metrics.effective_proxies['direct']] |
| 213 bad_proxies = [_TEST_SERVER + ":80"] | 212 bad_proxies = [_TEST_SERVER + ":80", metrics.PROXY_SETTING_HTTP] |
| 214 self._metrics.AddResultsForHTTPFallback(tab, results, proxies, bad_proxies) | 213 self._metrics.AddResultsForHTTPFallback(tab, results, proxies, bad_proxies) |
| 215 | 214 |
| 216 | 215 |
| 217 class ChromeProxySmoke(ChromeProxyValidation): | 216 class ChromeProxySmoke(ChromeProxyValidation): |
| 218 """Smoke measurement for basic chrome proxy correctness.""" | 217 """Smoke measurement for basic chrome proxy correctness.""" |
| 219 | 218 |
| 220 def __init__(self): | 219 def __init__(self): |
| 221 super(ChromeProxySmoke, self).__init__() | 220 super(ChromeProxySmoke, self).__init__() |
| 222 | 221 |
| 223 def WillNavigateToPage(self, page, tab): | 222 def WillNavigateToPage(self, page, tab): |
| (...skipping 19 matching lines...) Expand all Loading... |
| 243 ], | 242 ], |
| 244 'bypass': [self._metrics.AddResultsForBypass], | 243 'bypass': [self._metrics.AddResultsForBypass], |
| 245 'safebrowsing': [self._metrics.AddResultsForSafebrowsing], | 244 'safebrowsing': [self._metrics.AddResultsForSafebrowsing], |
| 246 } | 245 } |
| 247 if not self._page.name in page_to_metrics: | 246 if not self._page.name in page_to_metrics: |
| 248 raise page_test.MeasurementFailure( | 247 raise page_test.MeasurementFailure( |
| 249 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % ( | 248 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % ( |
| 250 self._page.name, page_to_metrics.keys())) | 249 self._page.name, page_to_metrics.keys())) |
| 251 for add_result in page_to_metrics[self._page.name]: | 250 for add_result in page_to_metrics[self._page.name]: |
| 252 add_result(tab, results) | 251 add_result(tab, results) |
| OLD | NEW |