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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 253 |
254 def CustomizeBrowserOptions(self, options): | 254 def CustomizeBrowserOptions(self, options): |
255 super(ChromeProxyClientVersion, | 255 super(ChromeProxyClientVersion, |
256 self).CustomizeBrowserOptions(options) | 256 self).CustomizeBrowserOptions(options) |
257 options.AppendExtraBrowserArgs('--user-agent="Chrome/32.0.1700.99"') | 257 options.AppendExtraBrowserArgs('--user-agent="Chrome/32.0.1700.99"') |
258 | 258 |
259 def AddResults(self, tab, results): | 259 def AddResults(self, tab, results): |
260 self._metrics.AddResultsForClientVersion(tab, results) | 260 self._metrics.AddResultsForClientVersion(tab, results) |
261 | 261 |
262 | 262 |
| 263 class ChromeProxyHTTPToDirectFallback(ChromeProxyValidation): |
| 264 """Correctness measurement for HTTP proxy fallback to direct.""" |
| 265 |
| 266 def __init__(self): |
| 267 super(ChromeProxyHTTPToDirectFallback, self).__init__( |
| 268 restart_after_each_page=True) |
| 269 |
| 270 def WillNavigateToPage(self, page, tab): |
| 271 super(ChromeProxyHTTPToDirectFallback, self).WillNavigateToPage(page, tab) |
| 272 # In order to have this test run starting from the HTTP fallback proxy, |
| 273 # the startup URL is set such that it will trigger a proxy fallback. |
| 274 # Verify that this is true before beginning the test proper. |
| 275 proxies = [ |
| 276 self._metrics.effective_proxies['proxy'], |
| 277 self._metrics.effective_proxies['fallback'], |
| 278 self._metrics.effective_proxies['direct']] |
| 279 bad_proxies = [self._metrics.effective_proxies['proxy']] |
| 280 self._metrics.VerifyProxyInfo(tab, proxies, bad_proxies) |
| 281 |
| 282 def AddResults(self, tab, results): |
| 283 self._metrics.AddResultsForHTTPToDirectFallback(tab, results) |
| 284 |
| 285 |
263 class ChromeProxySmoke(ChromeProxyValidation): | 286 class ChromeProxySmoke(ChromeProxyValidation): |
264 """Smoke measurement for basic chrome proxy correctness.""" | 287 """Smoke measurement for basic chrome proxy correctness.""" |
265 | 288 |
266 def __init__(self): | 289 def __init__(self): |
267 super(ChromeProxySmoke, self).__init__() | 290 super(ChromeProxySmoke, self).__init__() |
268 | 291 |
269 def WillNavigateToPage(self, page, tab): | 292 def WillNavigateToPage(self, page, tab): |
270 super(ChromeProxySmoke, self).WillNavigateToPage(page, tab) | 293 super(ChromeProxySmoke, self).WillNavigateToPage(page, tab) |
271 if page.name == 'safebrowsing': | 294 if page.name == 'safebrowsing': |
272 self._expect_timeout = True | 295 self._expect_timeout = True |
(...skipping 16 matching lines...) Expand all Loading... |
289 ], | 312 ], |
290 'bypass': [self._metrics.AddResultsForBypass], | 313 'bypass': [self._metrics.AddResultsForBypass], |
291 'safebrowsing': [self._metrics.AddResultsForSafebrowsing], | 314 'safebrowsing': [self._metrics.AddResultsForSafebrowsing], |
292 } | 315 } |
293 if not self._page.name in page_to_metrics: | 316 if not self._page.name in page_to_metrics: |
294 raise page_test.MeasurementFailure( | 317 raise page_test.MeasurementFailure( |
295 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % ( | 318 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % ( |
296 self._page.name, page_to_metrics.keys())) | 319 self._page.name, page_to_metrics.keys())) |
297 for add_result in page_to_metrics[self._page.name]: | 320 for add_result in page_to_metrics[self._page.name]: |
298 add_result(tab, results) | 321 add_result(tab, results) |
OLD | NEW |