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