From 478bfc70f088fdabd3e0e2da1d399a04d4610a92 Mon Sep 17 00:00:00 2001 From: bolian Date: Tue, 9 Sep 2014 16:01:10 -0700 Subject: [PATCH] Update metrics verification for dev-proxy. Remove http://aws1.mdw.la/piatek/bypass-demo, which is not bypassed by the server now. BUG=412497 Review URL: https://codereview.chromium.org/553543004 Cr-Commit-Position: refs/heads/master@{#294027} --- .../integration_tests/chrome_proxy_measurements.py | 3 +- .../integration_tests/chrome_proxy_metrics.py | 39 ++++++++++++++-------- .../chrome_proxy_pagesets/bypass.py | 1 - 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py b/tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py index fd92a4dfabc2..1b38598d35b5 100644 --- a/tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py +++ b/tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py @@ -183,7 +183,6 @@ class ChromeProxyHTTPFallbackProbeURL(ChromeProxyValidation): self._metrics.AddResultsForHTTPFallback(tab, results) -# Depends on the fix of http://crbug.com/330342. class ChromeProxyHTTPFallbackViaHeader(ChromeProxyValidation): """Correctness measurement for proxy fallback. @@ -210,7 +209,7 @@ class ChromeProxyHTTPFallbackViaHeader(ChromeProxyValidation): _TEST_SERVER + ":80", self._metrics.effective_proxies['fallback'], self._metrics.effective_proxies['direct']] - bad_proxies = [_TEST_SERVER + ":80"] + bad_proxies = [_TEST_SERVER + ":80", metrics.PROXY_SETTING_HTTP] self._metrics.AddResultsForHTTPFallback(tab, results, proxies, bad_proxies) diff --git a/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py b/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py index fd26a2d9254a..92ddce4e894f 100644 --- a/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py +++ b/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py @@ -20,6 +20,7 @@ CHROME_PROXY_VIA_HEADER_DEPRECATED = '1.1 Chrome Compression Proxy' PROXY_SETTING_HTTPS = 'proxy.googlezip.net:443' 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_DIRECT = 'direct://' @@ -97,6 +98,7 @@ class ChromeProxyMetric(network_metrics.NetworkMetric): self.compute_data_saving = True self.effective_proxies = { "proxy": PROXY_SETTING_HTTPS_WITH_SCHEME, + "proxy-dev": PROXY_DEV_SETTING_HTTPS_WITH_SCHEME, "fallback": PROXY_SETTING_HTTP, "direct": PROXY_SETTING_DIRECT, } @@ -140,14 +142,16 @@ class ChromeProxyMetric(network_metrics.NetworkMetric): for resp in self.IterResponses(tab): if resp.IsValidByViaHeader(): via_count += 1 - elif tab and self.IsProxyBypassed(tab): - logging.warning('Proxy bypassed for %s', resp.response.url) - bypass_count += 1 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)) + bypassed, _ = self.IsProxyBypassed(tab) + if tab and bypassed: + logging.warning('Proxy bypassed for %s', resp.response.url) + bypass_count += 1 + 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.current_page, 'checked_via_header', 'count', via_count)) results.AddValue(scalar.ScalarValue( @@ -160,10 +164,19 @@ class ChromeProxyMetric(network_metrics.NetworkMetric): raise ChromeProxyMetricException, ( 'Chrome proxy should be enabled. proxy info: %s' % info) - bad_proxies = [str(p['proxy']) for p in info['badProxies']].sort() + bad_proxies = [str(p['proxy']) for p in info['badProxies']] + bad_proxies.sort() proxies = [self.effective_proxies['proxy'], - self.effective_proxies['fallback']].sort() - return bad_proxies == proxies + self.effective_proxies['fallback']] + proxies.sort() + 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 def VerifyBadProxies( @@ -213,10 +226,8 @@ class ChromeProxyMetric(network_metrics.NetworkMetric): if not info['enabled']: raise ChromeProxyMetricException, ( 'Chrome proxy should be enabled. proxy info: %s' % info) - self.VerifyBadProxies( - info['badProxies'], - [self.effective_proxies['proxy'], - self.effective_proxies['fallback']]) + _, expected_bad_proxies = self.IsProxyBypassed(tab) + self.VerifyBadProxies(info['badProxies'], expected_bad_proxies) results.AddValue(scalar.ScalarValue( results.current_page, 'bypass', 'count', bypass_count)) diff --git a/tools/chrome_proxy/integration_tests/chrome_proxy_pagesets/bypass.py b/tools/chrome_proxy/integration_tests/chrome_proxy_pagesets/bypass.py index 37f9a18a020f..f8a764c22e11 100644 --- a/tools/chrome_proxy/integration_tests/chrome_proxy_pagesets/bypass.py +++ b/tools/chrome_proxy/integration_tests/chrome_proxy_pagesets/bypass.py @@ -23,7 +23,6 @@ class BypassPageSet(page_set_module.PageSet): urls_list = [ 'http://aws1.mdw.la/bypass/', - 'http://aws1.mdw.la/piatek/bypass-demo' ] for url in urls_list: -- 2.11.4.GIT