Commit 5d19ad1b authored by courage's avatar courage Committed by Commit bot

Revert of Update metrics verification for dev-proxy. (patchset #3 id:80001 of...

Revert of Update metrics verification for dev-proxy. (patchset #3 id:80001 of https://codereview.chromium.org/553543004/)

Reason for revert:
This appears to have made ChromeProxyMetricsTest.testChromeProxyMetricForHeaderValidation fail in Android Tests: https://build.chromium.org/p/chromium.linux/builders/Android%20Tests/builds/15658/steps/chrome_proxy/logs/stdio

Traceback (most recent call last):
  run at /usr/lib/python2.7/unittest/case.py:327
    testMethod()
  testChromeProxyMetricForHeaderValidation at tools/chrome_proxy/integration_tests/chrome_proxy_metrics_unittest.py:143
    metric.AddResultsForHeaderValidation(None, results)
  AddResultsForHeaderValidation at tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py:146
    bypassed, _ = self.IsProxyBypassed(tab)
  IsProxyBypassed at tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py:167
    bad_proxies = [str(p['proxy']) for p in info['badProxies']]
KeyError: 'badProxies'

Locals:
  info : {'proxies': ['compress.googlezip.net:80', 'direct://'], 'enabled': True}
  tab  : None

Original issue's description:
> Update metrics verification for dev-proxy.
> Remove http://aws1.mdw.la/piatek/bypass-demo, which is not bypassed by the server now.
>
> BUG=412497
>
> Committed: https://chromium.googlesource.com/chromium/src/+/0bae38f3f8525a2b49d6df9f7152e1cc130851b1

TBR=bengr@chromium.org,bolian@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=412497

Review URL: https://codereview.chromium.org/555373002

Cr-Commit-Position: refs/heads/master@{#294065}
parent fe42c554
...@@ -183,6 +183,7 @@ class ChromeProxyHTTPFallbackProbeURL(ChromeProxyValidation): ...@@ -183,6 +183,7 @@ class ChromeProxyHTTPFallbackProbeURL(ChromeProxyValidation):
self._metrics.AddResultsForHTTPFallback(tab, results) self._metrics.AddResultsForHTTPFallback(tab, results)
# Depends on the fix of http://crbug.com/330342.
class ChromeProxyHTTPFallbackViaHeader(ChromeProxyValidation): class ChromeProxyHTTPFallbackViaHeader(ChromeProxyValidation):
"""Correctness measurement for proxy fallback. """Correctness measurement for proxy fallback.
...@@ -209,7 +210,7 @@ class ChromeProxyHTTPFallbackViaHeader(ChromeProxyValidation): ...@@ -209,7 +210,7 @@ class ChromeProxyHTTPFallbackViaHeader(ChromeProxyValidation):
_TEST_SERVER + ":80", _TEST_SERVER + ":80",
self._metrics.effective_proxies['fallback'], self._metrics.effective_proxies['fallback'],
self._metrics.effective_proxies['direct']] self._metrics.effective_proxies['direct']]
bad_proxies = [_TEST_SERVER + ":80", metrics.PROXY_SETTING_HTTP] bad_proxies = [_TEST_SERVER + ":80"]
self._metrics.AddResultsForHTTPFallback(tab, results, proxies, bad_proxies) self._metrics.AddResultsForHTTPFallback(tab, results, proxies, bad_proxies)
......
...@@ -20,7 +20,6 @@ CHROME_PROXY_VIA_HEADER_DEPRECATED = '1.1 Chrome Compression Proxy' ...@@ -20,7 +20,6 @@ CHROME_PROXY_VIA_HEADER_DEPRECATED = '1.1 Chrome Compression Proxy'
PROXY_SETTING_HTTPS = 'proxy.googlezip.net:443' PROXY_SETTING_HTTPS = 'proxy.googlezip.net:443'
PROXY_SETTING_HTTPS_WITH_SCHEME = 'https://' + PROXY_SETTING_HTTPS PROXY_SETTING_HTTPS_WITH_SCHEME = 'https://' + PROXY_SETTING_HTTPS
PROXY_DEV_SETTING_HTTPS_WITH_SCHEME = 'http://proxy-dev.googlezip.net:80'
PROXY_SETTING_HTTP = 'compress.googlezip.net:80' PROXY_SETTING_HTTP = 'compress.googlezip.net:80'
PROXY_SETTING_DIRECT = 'direct://' PROXY_SETTING_DIRECT = 'direct://'
...@@ -98,7 +97,6 @@ class ChromeProxyMetric(network_metrics.NetworkMetric): ...@@ -98,7 +97,6 @@ class ChromeProxyMetric(network_metrics.NetworkMetric):
self.compute_data_saving = True self.compute_data_saving = True
self.effective_proxies = { self.effective_proxies = {
"proxy": PROXY_SETTING_HTTPS_WITH_SCHEME, "proxy": PROXY_SETTING_HTTPS_WITH_SCHEME,
"proxy-dev": PROXY_DEV_SETTING_HTTPS_WITH_SCHEME,
"fallback": PROXY_SETTING_HTTP, "fallback": PROXY_SETTING_HTTP,
"direct": PROXY_SETTING_DIRECT, "direct": PROXY_SETTING_DIRECT,
} }
...@@ -142,16 +140,14 @@ class ChromeProxyMetric(network_metrics.NetworkMetric): ...@@ -142,16 +140,14 @@ class ChromeProxyMetric(network_metrics.NetworkMetric):
for resp in self.IterResponses(tab): for resp in self.IterResponses(tab):
if resp.IsValidByViaHeader(): if resp.IsValidByViaHeader():
via_count += 1 via_count += 1
elif tab and self.IsProxyBypassed(tab):
logging.warning('Proxy bypassed for %s', resp.response.url)
bypass_count += 1
else: else:
bypassed, _ = self.IsProxyBypassed(tab) r = resp.response
if tab and bypassed: raise ChromeProxyMetricException, (
logging.warning('Proxy bypassed for %s', resp.response.url) '%s: Via header (%s) is not valid (refer=%s, status=%d)' % (
bypass_count += 1 r.url, r.GetHeader('Via'), r.GetHeader('Referer'), r.status))
else:
r = resp.response
raise ChromeProxyMetricException, (
'%s: Via header (%s) is not valid (refer=%s, status=%d)' % (
r.url, r.GetHeader('Via'), r.GetHeader('Referer'), r.status))
results.AddValue(scalar.ScalarValue( results.AddValue(scalar.ScalarValue(
results.current_page, 'checked_via_header', 'count', via_count)) results.current_page, 'checked_via_header', 'count', via_count))
results.AddValue(scalar.ScalarValue( results.AddValue(scalar.ScalarValue(
...@@ -164,19 +160,10 @@ class ChromeProxyMetric(network_metrics.NetworkMetric): ...@@ -164,19 +160,10 @@ class ChromeProxyMetric(network_metrics.NetworkMetric):
raise ChromeProxyMetricException, ( raise ChromeProxyMetricException, (
'Chrome proxy should be enabled. proxy info: %s' % info) 'Chrome proxy should be enabled. proxy info: %s' % info)
bad_proxies = [str(p['proxy']) for p in info['badProxies']] bad_proxies = [str(p['proxy']) for p in info['badProxies']].sort()
bad_proxies.sort()
proxies = [self.effective_proxies['proxy'], proxies = [self.effective_proxies['proxy'],
self.effective_proxies['fallback']] self.effective_proxies['fallback']].sort()
proxies.sort() return bad_proxies == proxies
proxies_dev = [self.effective_proxies['proxy-dev'],
self.effective_proxies['fallback']]
proxies_dev.sort()
if bad_proxies == proxies:
return True, proxies
elif bad_proxies == proxies_dev:
return True, proxies_dev
return False, []
@staticmethod @staticmethod
def VerifyBadProxies( def VerifyBadProxies(
...@@ -226,8 +213,10 @@ class ChromeProxyMetric(network_metrics.NetworkMetric): ...@@ -226,8 +213,10 @@ class ChromeProxyMetric(network_metrics.NetworkMetric):
if not info['enabled']: if not info['enabled']:
raise ChromeProxyMetricException, ( raise ChromeProxyMetricException, (
'Chrome proxy should be enabled. proxy info: %s' % info) 'Chrome proxy should be enabled. proxy info: %s' % info)
_, expected_bad_proxies = self.IsProxyBypassed(tab) self.VerifyBadProxies(
self.VerifyBadProxies(info['badProxies'], expected_bad_proxies) info['badProxies'],
[self.effective_proxies['proxy'],
self.effective_proxies['fallback']])
results.AddValue(scalar.ScalarValue( results.AddValue(scalar.ScalarValue(
results.current_page, 'bypass', 'count', bypass_count)) results.current_page, 'bypass', 'count', bypass_count))
......
...@@ -23,6 +23,7 @@ class BypassPageSet(page_set_module.PageSet): ...@@ -23,6 +23,7 @@ class BypassPageSet(page_set_module.PageSet):
urls_list = [ urls_list = [
'http://aws1.mdw.la/bypass/', 'http://aws1.mdw.la/bypass/',
'http://aws1.mdw.la/piatek/bypass-demo'
] ]
for url in urls_list: for url in urls_list:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment