| 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 940c97924e0d8e80419265f6d64f9e8d6a4898b6..83869008f4baab2438317c60f764587f1345a5f9 100644
|
| --- a/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py
|
| +++ b/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py
|
| @@ -214,34 +214,25 @@ class ChromeProxyMetric(network_metrics.NetworkMetric):
|
| lo_fi_count = 0
|
|
|
| for resp in self.IterResponses(tab):
|
| - if resp.HasChromeProxyViaHeader():
|
| + if resp.HasChromeProxyLoFi():
|
| lo_fi_count += 1
|
| else:
|
| - r = resp.response
|
| raise ChromeProxyMetricException, (
|
| - '%s: LoFi not in request header.' % (r.url))
|
| + '%s: LoFi not in request header.' % (resp.response.url))
|
|
|
| - cl = resp.content_length
|
| - resource = resp.response.url
|
| - results.AddValue(scalar.ScalarValue(
|
| - results.current_page, 'lo_fi', 'count', lo_fi_count))
|
| -
|
| - for resp in self.IterResponses(tab):
|
| - r = resp.response
|
| - cl = resp.content_length
|
| - ocl = resp.original_content_length
|
| - saving = resp.data_saving_rate * 100
|
| - if cl > 100:
|
| + if resp.content_length > 100:
|
| raise ChromeProxyMetricException, (
|
| 'Image %s is %d bytes. Expecting less than 100 bytes.' %
|
| - (resource, cl))
|
| + (resp.response.url, resp.content_length))
|
| +
|
| + if lo_fi_count == 0:
|
| + raise ChromeProxyMetricException, (
|
| + 'Expected at least one LoFi response, but zero such responses were '
|
| + 'received.')
|
|
|
| results.AddValue(scalar.ScalarValue(
|
| - results.current_page, 'content_length', 'bytes', cl))
|
| - results.AddValue(scalar.ScalarValue(
|
| - results.current_page, 'original_content_length', 'bytes', ocl))
|
| - results.AddValue(scalar.ScalarValue(
|
| - results.current_page, 'data_saving', 'percent', saving))
|
| + results.current_page, 'lo_fi', 'count', lo_fi_count))
|
| + super(ChromeProxyMetric, self).AddResults(tab, results)
|
|
|
| def AddResultsForBypass(self, tab, results):
|
| bypass_count = 0
|
|
|