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

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

Issue 1131063005: Integration test for Lo-Fi directives in the Chrome-Proxy response header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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
« no previous file with comments | « tools/chrome_proxy/common/chrome_proxy_metrics.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d03bda9e86b2e8bdf5c2e7faac46c1fa3eb47152..793acebbaffca3671462151cea88d3c37c4d9f68 100644
--- a/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py
+++ b/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py
@@ -225,27 +225,40 @@ class ChromeProxyMetric(network_metrics.NetworkMetric):
results.current_page, 'bypass', 'count', bypass_count))
def AddResultsForLoFi(self, tab, results):
- lo_fi_count = 0
+ lo_fi_request_count = 0
+ lo_fi_response_count = 0
for resp in self.IterResponses(tab):
- if resp.HasChromeProxyLoFi():
- lo_fi_count += 1
+ if resp.HasChromeProxyLoFiRequest():
+ lo_fi_request_count += 1
else:
raise ChromeProxyMetricException, (
'%s: LoFi not in request header.' % (resp.response.url))
+ if resp.HasChromeProxyLoFiResponse():
+ lo_fi_response_count += 1
+ else:
+ raise ChromeProxyMetricException, (
+ '%s: LoFi not in response header.' % (resp.response.url))
+
if resp.content_length > 100:
raise ChromeProxyMetricException, (
'Image %s is %d bytes. Expecting less than 100 bytes.' %
(resp.response.url, resp.content_length))
- if lo_fi_count == 0:
+ if lo_fi_request_count == 0:
+ raise ChromeProxyMetricException, (
+ 'Expected at least one LoFi request, but zero such requests were '
+ 'sent.')
+ if lo_fi_response_count == 0:
raise ChromeProxyMetricException, (
'Expected at least one LoFi response, but zero such responses were '
'received.')
results.AddValue(scalar.ScalarValue(
- results.current_page, 'lo_fi', 'count', lo_fi_count))
+ results.current_page, 'lo_fi_request', 'count', lo_fi_request_count))
+ results.AddValue(scalar.ScalarValue(
+ results.current_page, 'lo_fi_response', 'count', lo_fi_response_count))
super(ChromeProxyMetric, self).AddResults(tab, results)
def AddResultsForBypass(self, tab, results):
« no previous file with comments | « tools/chrome_proxy/common/chrome_proxy_metrics.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698