Index: tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py |
diff --git a/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py b/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py |
index 7a070f46a02d0f6339b93435832015513af04c24..3ecc67621163754498889ebc450f492c67ab9b05 100644 |
--- a/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py |
+++ b/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py |
@@ -420,7 +420,7 @@ class ChromeProxyMetric(network_metrics.NetworkMetric): |
results.AddValue(scalar.ScalarValue( |
results.current_page, 'bypass', 'count', bypass_count)) |
- def AddResultsForSafebrowsing(self, tab, results): |
+ def AddResultsForSafebrowsingMobile(self, tab, results): |
count = 0 |
safebrowsing_count = 0 |
for resp in self.IterResponses(tab): |
@@ -441,6 +441,27 @@ class ChromeProxyMetric(network_metrics.NetworkMetric): |
'Safebrowsing failed (count=%d, safebrowsing_count=%d)\n' % ( |
count, safebrowsing_count)) |
+ def AddResultsForSafebrowsingDesktop(self, tab, results): |
+ count = 0 |
+ safebrowsing_count = 0 |
+ for resp in self.IterResponses(tab): |
+ count += 1 |
+ if resp.HasChromeProxyViaHeader(): |
+ safebrowsing_count += 1 |
+ else: |
+ r = resp.response |
+ raise ChromeProxyMetricException, ( |
+ '%s: Safebrowsing feature should be off for desktop.\n' |
+ 'Reponse: status=(%d, %s)\nHeaders:\n %s' % ( |
+ r.url, r.status, r.status_text, r.headers)) |
+ if count == safebrowsing_count: |
+ results.AddValue(scalar.ScalarValue( |
+ results.current_page, 'safebrowsing', 'boolean', True)) |
+ else: |
+ raise ChromeProxyMetricException, ( |
+ 'Safebrowsing failed (count=%d, safebrowsing_count=%d)\n' % ( |
+ count, safebrowsing_count)) |
+ |
def VerifyProxyInfo(self, tab, expected_proxies, expected_bad_proxies): |
info = GetProxyInfoFromNetworkInternals(tab) |
if not 'enabled' in info or not info['enabled']: |