Chromium Code Reviews| 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 3f765bf68ad8d10e4cb2509427d6e9816c7a64e6..01d801b0fbd3d59eb0080e9a488556f1ab073659 100644 |
| --- a/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py |
| +++ b/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py |
| @@ -235,6 +235,39 @@ class ChromeProxyMetric(network_metrics.NetworkMetric): |
| results.AddValue(scalar.ScalarValue( |
| results.current_page, 'bypass', 'count', bypass_count)) |
| + def AddResultsForBlockSingle(self, tab, results): |
| + eligible_response_count = 0 |
| + bypass_count = 0 |
| + for resp in self.IterResponses(tab): |
| + if resp.ShouldHaveChromeProxyViaHeader(): |
| + eligible_response_count += 1 |
| + if not resp.HasChromeProxyViaHeader(): |
| + 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: |
|
bolian
2014/09/16 17:04:06
Question. Why there will be more than one? Do you
sclittle
2014/09/16 19:06:53
There would be more than one because http://check.
bolian
2014/09/16 20:56:00
No, don't remove that. :) I wasn't aware that the
|
| + raise ChromeProxyMetricException, ( |
| + 'There should be more than one DRP eligible response ' |
| + '(eligible_response_count=%d, bypass_count=%d)\n' % ( |
| + eligible_response_count, bypass_count)) |
| + elif bypass_count != 1: |
| + raise ChromeProxyMetricException, ( |
| + 'Exactly one response should be bypassed. ' |
| + '(eligible_response_count=%d, bypass_count=%d)\n' % ( |
| + eligible_response_count, bypass_count)) |
| + else: |
| + results.AddValue(scalar.ScalarValue( |
| + results.current_page, 'eligible_responses', 'count', |
| + eligible_response_count)) |
| + results.AddValue(scalar.ScalarValue( |
| + results.current_page, 'bypass', 'count', bypass_count)) |
| + |
| def AddResultsForSafebrowsing(self, tab, results): |
| count = 0 |
| safebrowsing_count = 0 |