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): |