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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 206 |
207 def AddResults(self, tab, results): | 207 def AddResults(self, tab, results): |
208 proxies = [ | 208 proxies = [ |
209 _TEST_SERVER + ":80", | 209 _TEST_SERVER + ":80", |
210 self._metrics.effective_proxies['fallback'], | 210 self._metrics.effective_proxies['fallback'], |
211 self._metrics.effective_proxies['direct']] | 211 self._metrics.effective_proxies['direct']] |
212 bad_proxies = [_TEST_SERVER + ":80", metrics.PROXY_SETTING_HTTP] | 212 bad_proxies = [_TEST_SERVER + ":80", metrics.PROXY_SETTING_HTTP] |
213 self._metrics.AddResultsForHTTPFallback(tab, results, proxies, bad_proxies) | 213 self._metrics.AddResultsForHTTPFallback(tab, results, proxies, bad_proxies) |
214 | 214 |
215 | 215 |
| 216 class ChromeProxyClientVersion(ChromeProxyValidation): |
| 217 """Correctness measurement for version directives in Chrome-Proxy header. |
| 218 |
| 219 The test verifies that the version information provided in the Chrome-Proxy |
| 220 request header overrides any version, if specified, that is provided in the |
| 221 user agent string. |
| 222 """ |
| 223 |
| 224 def __init__(self): |
| 225 super(ChromeProxyClientVersion, self).__init__() |
| 226 |
| 227 def CustomizeBrowserOptions(self, options): |
| 228 super(ChromeProxyClientVersion, |
| 229 self).CustomizeBrowserOptions(options) |
| 230 options.AppendExtraBrowserArgs('--user-agent="Chrome/32.0.1700.99"') |
| 231 |
| 232 def AddResults(self, tab, results): |
| 233 self._metrics.AddResultsForClientVersion(tab, results) |
| 234 |
| 235 |
216 class ChromeProxySmoke(ChromeProxyValidation): | 236 class ChromeProxySmoke(ChromeProxyValidation): |
217 """Smoke measurement for basic chrome proxy correctness.""" | 237 """Smoke measurement for basic chrome proxy correctness.""" |
218 | 238 |
219 def __init__(self): | 239 def __init__(self): |
220 super(ChromeProxySmoke, self).__init__() | 240 super(ChromeProxySmoke, self).__init__() |
221 | 241 |
222 def WillNavigateToPage(self, page, tab): | 242 def WillNavigateToPage(self, page, tab): |
223 super(ChromeProxySmoke, self).WillNavigateToPage(page, tab) | 243 super(ChromeProxySmoke, self).WillNavigateToPage(page, tab) |
224 if page.name == 'safebrowsing': | 244 if page.name == 'safebrowsing': |
225 self._expect_timeout = True | 245 self._expect_timeout = True |
(...skipping 16 matching lines...) Expand all Loading... |
242 ], | 262 ], |
243 'bypass': [self._metrics.AddResultsForBypass], | 263 'bypass': [self._metrics.AddResultsForBypass], |
244 'safebrowsing': [self._metrics.AddResultsForSafebrowsing], | 264 'safebrowsing': [self._metrics.AddResultsForSafebrowsing], |
245 } | 265 } |
246 if not self._page.name in page_to_metrics: | 266 if not self._page.name in page_to_metrics: |
247 raise page_test.MeasurementFailure( | 267 raise page_test.MeasurementFailure( |
248 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % ( | 268 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % ( |
249 self._page.name, page_to_metrics.keys())) | 269 self._page.name, page_to_metrics.keys())) |
250 for add_result in page_to_metrics[self._page.name]: | 270 for add_result in page_to_metrics[self._page.name]: |
251 add_result(tab, results) | 271 add_result(tab, results) |
OLD | NEW |