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

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

Issue 663333004: Remove proxy retry time condition from CORS bypass integration test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 datetime 5 import datetime
6 import logging 6 import logging
7 import os 7 import os
8 8
9 from integration_tests import network_metrics 9 from integration_tests import network_metrics
10 from telemetry.page import page_test 10 from telemetry.page import page_test
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 got_retry_time = datetime.datetime.fromtimestamp( 247 got_retry_time = datetime.datetime.fromtimestamp(
248 int(bad_proxy['retry'])/1000) 248 int(bad_proxy['retry'])/1000)
249 if not ProxyRetryTimeInRange( 249 if not ProxyRetryTimeInRange(
250 got_retry_time, retry_time_low, retry_time_high): 250 got_retry_time, retry_time_low, retry_time_high):
251 raise ChromeProxyMetricException, ( 251 raise ChromeProxyMetricException, (
252 'Bad proxy %s retry time (%s) should be within range (%s-%s).' % ( 252 'Bad proxy %s retry time (%s) should be within range (%s-%s).' % (
253 bad_proxy['proxy'], str(got_retry_time), str(retry_time_low), 253 bad_proxy['proxy'], str(got_retry_time), str(retry_time_low),
254 str(retry_time_high))) 254 str(retry_time_high)))
255 255
256 def VerifyAllProxiesBypassed(self, tab): 256 def VerifyAllProxiesBypassed(self, tab):
257 """Verify that all proxies are bypassed for 1 to 5 minutes."""
257 if tab: 258 if tab:
258 info = GetProxyInfoFromNetworkInternals(tab) 259 info = GetProxyInfoFromNetworkInternals(tab)
259 if not info['enabled']: 260 if not info['enabled']:
260 raise ChromeProxyMetricException, ( 261 raise ChromeProxyMetricException, (
261 'Chrome proxy should be enabled. proxy info: %s' % info) 262 'Chrome proxy should be enabled. proxy info: %s' % info)
262 is_bypassed, expected_bad_proxies = self.IsProxyBypassed(tab) 263 is_bypassed, expected_bad_proxies = self.IsProxyBypassed(tab)
263 if not is_bypassed: 264 if not is_bypassed:
264 raise ChromeProxyMetricException, ( 265 raise ChromeProxyMetricException, (
265 'Chrome proxy should be bypassed. proxy info: %s' % info) 266 'Chrome proxy should be bypassed. proxy info: %s' % info)
266 self.VerifyBadProxies(info['badProxies'], 267 self.VerifyBadProxies(info['badProxies'],
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 '%s: Got a 502 without a subsequent 200' % (url)) 334 '%s: Got a 502 without a subsequent 200' % (url))
334 elif bypasses[url] > 1: 335 elif bypasses[url] > 1:
335 raise ChromeProxyMetricException, ( 336 raise ChromeProxyMetricException, (
336 '%s: Got a 502 and multiple 200s: %d' % (url, bypasses[url])) 337 '%s: Got a 502 and multiple 200s: %d' % (url, bypasses[url]))
337 if bypass_count == 0: 338 if bypass_count == 0:
338 raise ChromeProxyMetricException, ( 339 raise ChromeProxyMetricException, (
339 'At least one response should be bypassed. ' 340 'At least one response should be bypassed. '
340 '(eligible_response_count=%d, bypass_count=%d)\n' % ( 341 '(eligible_response_count=%d, bypass_count=%d)\n' % (
341 eligible_response_count, bypass_count)) 342 eligible_response_count, bypass_count))
342 343
343 self.VerifyAllProxiesBypassed(tab)
344 results.AddValue(scalar.ScalarValue( 344 results.AddValue(scalar.ScalarValue(
345 results.current_page, 'cors_bypass', 'count', bypass_count)) 345 results.current_page, 'cors_bypass', 'count', bypass_count))
346 346
347 def AddResultsForBlockOnce(self, tab, results): 347 def AddResultsForBlockOnce(self, tab, results):
348 eligible_response_count = 0 348 eligible_response_count = 0
349 bypass_count = 0 349 bypass_count = 0
350 for resp in self.IterResponses(tab): 350 for resp in self.IterResponses(tab):
351 if resp.ShouldHaveChromeProxyViaHeader(): 351 if resp.ShouldHaveChromeProxyViaHeader():
352 eligible_response_count += 1 352 eligible_response_count += 1
353 if not resp.HasChromeProxyViaHeader(): 353 if not resp.HasChromeProxyViaHeader():
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 raise ChromeProxyMetricException, ( 397 raise ChromeProxyMetricException, (
398 'Safebrowsing failed (count=%d, safebrowsing_count=%d)\n' % ( 398 'Safebrowsing failed (count=%d, safebrowsing_count=%d)\n' % (
399 count, safebrowsing_count)) 399 count, safebrowsing_count))
400 400
401 def VerifyProxyInfo(self, tab, expected_proxies, expected_bad_proxies): 401 def VerifyProxyInfo(self, tab, expected_proxies, expected_bad_proxies):
402 info = GetProxyInfoFromNetworkInternals(tab) 402 info = GetProxyInfoFromNetworkInternals(tab)
403 if not 'enabled' in info or not info['enabled']: 403 if not 'enabled' in info or not info['enabled']:
404 raise ChromeProxyMetricException, ( 404 raise ChromeProxyMetricException, (
405 'Chrome proxy should be enabled. proxy info: %s' % info) 405 'Chrome proxy should be enabled. proxy info: %s' % info)
406 proxies = info['proxies'] 406 proxies = info['proxies']
407 if (proxies != expected_proxies and 407 if (set(proxies) != set(expected_proxies) and
408 proxies != self.ProxyListForDev(expected_proxies)): 408 set(proxies) != set(self.ProxyListForDev(expected_proxies))):
409 raise ChromeProxyMetricException, ( 409 raise ChromeProxyMetricException, (
410 'Wrong effective proxies (%s). Expect: "%s"' % ( 410 'Wrong effective proxies (%s). Expect: "%s"' % (
411 str(proxies), str(expected_proxies))) 411 str(proxies), str(expected_proxies)))
412 412
413 bad_proxies = [] 413 bad_proxies = []
414 if 'badProxies' in info and info['badProxies']: 414 if 'badProxies' in info and info['badProxies']:
415 bad_proxies = [p['proxy'] for p in info['badProxies'] 415 bad_proxies = [p['proxy'] for p in info['badProxies']
416 if 'proxy' in p and p['proxy']] 416 if 'proxy' in p and p['proxy']]
417 if (bad_proxies != expected_bad_proxies and 417 if (set(bad_proxies) != set(expected_bad_proxies) and
418 bad_proxies != self.ProxyListForDev(expected_bad_proxies)): 418 set(bad_proxies) != set(self.ProxyListForDev(expected_bad_proxies))):
419 raise ChromeProxyMetricException, ( 419 raise ChromeProxyMetricException, (
420 'Wrong bad proxies (%s). Expect: "%s"' % ( 420 'Wrong bad proxies (%s). Expect: "%s"' % (
421 str(bad_proxies), str(expected_bad_proxies))) 421 str(bad_proxies), str(expected_bad_proxies)))
422 422
423 def AddResultsForHTTPFallback( 423 def AddResultsForHTTPFallback(
424 self, tab, results, expected_proxies=None, expected_bad_proxies=None): 424 self, tab, results, expected_proxies=None, expected_bad_proxies=None):
425 if not expected_proxies: 425 if not expected_proxies:
426 expected_proxies = [self.effective_proxies['fallback'], 426 expected_proxies = [self.effective_proxies['fallback'],
427 self.effective_proxies['direct']] 427 self.effective_proxies['direct']]
428 if not expected_bad_proxies: 428 if not expected_bad_proxies:
(...skipping 19 matching lines...) Expand all
448 See the definition of VerifyBadProxies for details. 448 See the definition of VerifyBadProxies for details.
449 """ 449 """
450 info = GetProxyInfoFromNetworkInternals(tab) 450 info = GetProxyInfoFromNetworkInternals(tab)
451 if not 'enabled' in info or not info['enabled']: 451 if not 'enabled' in info or not info['enabled']:
452 raise ChromeProxyMetricException, ( 452 raise ChromeProxyMetricException, (
453 'Chrome proxy should be enabled. proxy info: %s' % info) 453 'Chrome proxy should be enabled. proxy info: %s' % info)
454 self.VerifyBadProxies(info['badProxies'], 454 self.VerifyBadProxies(info['badProxies'],
455 expected_bad_proxies) 455 expected_bad_proxies)
456 results.AddValue(scalar.ScalarValue( 456 results.AddValue(scalar.ScalarValue(
457 results.current_page, 'explicit_bypass', 'boolean', True)) 457 results.current_page, 'explicit_bypass', 'boolean', True))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698