Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py

Issue 558743003: Integration test for bypassing the proxy for a single request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698