Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Side by Side Diff: tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py

Issue 655703002: Added integration tests for falling back from the HTTP proxy to direct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 proxies = [
273 self._metrics.effective_proxies['proxy'],
274 self._metrics.effective_proxies['fallback'],
275 self._metrics.effective_proxies['direct']]
276 bad_proxies = [self._metrics.effective_proxies['proxy']]
277 self._metrics.VerifyProxyInfo(tab, proxies, bad_proxies)
bolian 2014/10/14 06:00:49 Why there is bad proxy already before navigation?
sclittle 2014/10/14 17:36:45 Added a comment. In order to have the test run st
278
279 def AddResults(self, tab, results):
280 self._metrics.AddResultsForHTTPToDirectFallback(tab, results)
281
282
263 class ChromeProxySmoke(ChromeProxyValidation): 283 class ChromeProxySmoke(ChromeProxyValidation):
264 """Smoke measurement for basic chrome proxy correctness.""" 284 """Smoke measurement for basic chrome proxy correctness."""
265 285
266 def __init__(self): 286 def __init__(self):
267 super(ChromeProxySmoke, self).__init__() 287 super(ChromeProxySmoke, self).__init__()
268 288
269 def WillNavigateToPage(self, page, tab): 289 def WillNavigateToPage(self, page, tab):
270 super(ChromeProxySmoke, self).WillNavigateToPage(page, tab) 290 super(ChromeProxySmoke, self).WillNavigateToPage(page, tab)
271 if page.name == 'safebrowsing': 291 if page.name == 'safebrowsing':
272 self._expect_timeout = True 292 self._expect_timeout = True
(...skipping 16 matching lines...) Expand all
289 ], 309 ],
290 'bypass': [self._metrics.AddResultsForBypass], 310 'bypass': [self._metrics.AddResultsForBypass],
291 'safebrowsing': [self._metrics.AddResultsForSafebrowsing], 311 'safebrowsing': [self._metrics.AddResultsForSafebrowsing],
292 } 312 }
293 if not self._page.name in page_to_metrics: 313 if not self._page.name in page_to_metrics:
294 raise page_test.MeasurementFailure( 314 raise page_test.MeasurementFailure(
295 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % ( 315 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % (
296 self._page.name, page_to_metrics.keys())) 316 self._page.name, page_to_metrics.keys()))
297 for add_result in page_to_metrics[self._page.name]: 317 for add_result in page_to_metrics[self._page.name]:
298 add_result(tab, results) 318 add_result(tab, results)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698