Commit 56414964 authored by sclittle's avatar sclittle Committed by Commit bot

Reduce DRP telemetry tests' dependence on net-internals#proxy.

Reduce the data reduction proxy tests' dependence on
net-internals#proxy. After this change, the only tests that still depend
on net-internals#proxy are http_to_direct_fallback, fallback_viaheader,
fallback_probe, explicit_bypass. These tests, along with the
safebrowsing test, are the only ones that can't run against the
android-webview-shell yet.

BUG=440522

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

Cr-Commit-Position: refs/heads/master@{#307940}
parent d41b505b
...@@ -310,6 +310,9 @@ class ChromeProxyHTTPToDirectFallback(ChromeProxyValidation): ...@@ -310,6 +310,9 @@ class ChromeProxyHTTPToDirectFallback(ChromeProxyValidation):
'nonexistent.googlezip.net:80', 'nonexistent.googlezip.net:80',
self._metrics.effective_proxies['fallback'], self._metrics.effective_proxies['fallback'],
self._metrics.effective_proxies['direct']] self._metrics.effective_proxies['direct']]
# TODO(sclittle): Remove this dependency on net-internals#proxy once an
# alternative method of verifying that Chrome is on the fallback proxy
# exists.
self._metrics.VerifyProxyInfo(tab, proxies, proxies[:1]) self._metrics.VerifyProxyInfo(tab, proxies, proxies[:1])
def AddResults(self, tab, results): def AddResults(self, tab, results):
......
...@@ -353,7 +353,6 @@ class ChromeProxyMetric(network_metrics.NetworkMetric): ...@@ -353,7 +353,6 @@ class ChromeProxyMetric(network_metrics.NetworkMetric):
r.url, r.GetHeader('Via'), r.GetHeader('Referer'), r.status)) r.url, r.GetHeader('Via'), r.GetHeader('Referer'), r.status))
bypass_count += 1 bypass_count += 1
self.VerifyAllProxiesBypassed(tab)
results.AddValue(scalar.ScalarValue( results.AddValue(scalar.ScalarValue(
results.current_page, 'bypass', 'count', bypass_count)) results.current_page, 'bypass', 'count', bypass_count))
...@@ -404,13 +403,6 @@ class ChromeProxyMetric(network_metrics.NetworkMetric): ...@@ -404,13 +403,6 @@ class ChromeProxyMetric(network_metrics.NetworkMetric):
if not resp.HasChromeProxyViaHeader(): if not resp.HasChromeProxyViaHeader():
bypass_count += 1 bypass_count += 1
if tab:
info = GetProxyInfoFromNetworkInternals(tab)
if not info['enabled']:
raise ChromeProxyMetricException, (
'Chrome proxy should be enabled. proxy info: %s' % info)
self.VerifyBadProxies(info['badProxies'], [])
if eligible_response_count <= 1: if eligible_response_count <= 1:
raise ChromeProxyMetricException, ( raise ChromeProxyMetricException, (
'There should be more than one DRP eligible response ' 'There should be more than one DRP eligible response '
...@@ -479,14 +471,27 @@ class ChromeProxyMetric(network_metrics.NetworkMetric): ...@@ -479,14 +471,27 @@ class ChromeProxyMetric(network_metrics.NetworkMetric):
if not expected_bad_proxies: if not expected_bad_proxies:
expected_bad_proxies = [] expected_bad_proxies = []
# TODO(sclittle): Remove this dependency on net-internals#proxy once an
# alternative method of verifying that Chrome is on the fallback proxy
# exists.
self.VerifyProxyInfo(tab, expected_proxies, expected_bad_proxies) self.VerifyProxyInfo(tab, expected_proxies, expected_bad_proxies)
results.AddValue(scalar.ScalarValue( results.AddValue(scalar.ScalarValue(
results.current_page, 'http_fallback', 'boolean', True)) results.current_page, 'http_fallback', 'boolean', True))
def AddResultsForHTTPToDirectFallback(self, tab, results): def AddResultsForHTTPToDirectFallback(self, tab, results):
self.VerifyAllProxiesBypassed(tab) bypass_count = 0
for resp in self.IterResponses(tab):
if resp.HasChromeProxyViaHeader():
r = resp.response
raise ChromeProxyMetricException, (
'Response for %s should not have via header. '
'Reponse: status=(%d, %s)\nHeaders:\n %s' % (
r.url, r.status, r.status_text, r.headers))
else:
bypass_count += 1
results.AddValue(scalar.ScalarValue( results.AddValue(scalar.ScalarValue(
results.current_page, 'direct_fallback', 'boolean', True)) results.current_page, 'bypass', 'count', bypass_count))
def AddResultsForExplicitBypass(self, tab, results, expected_bad_proxies): def AddResultsForExplicitBypass(self, tab, results, expected_bad_proxies):
"""Verify results for an explicit bypass test. """Verify results for an explicit bypass test.
...@@ -502,6 +507,9 @@ class ChromeProxyMetric(network_metrics.NetworkMetric): ...@@ -502,6 +507,9 @@ class ChromeProxyMetric(network_metrics.NetworkMetric):
if not 'enabled' in info or not info['enabled']: if not 'enabled' in info or 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)
# TODO(sclittle): Remove this dependency on net-internals#proxy once an
# alternative method of verifying that Chrome is on the fallback proxy
# exists.
self.VerifyBadProxies(info['badProxies'], self.VerifyBadProxies(info['badProxies'],
expected_bad_proxies) expected_bad_proxies)
results.AddValue(scalar.ScalarValue( results.AddValue(scalar.ScalarValue(
......
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