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 940c97924e0d8e80419265f6d64f9e8d6a4898b6..63e8e4c15d0efa5b6c266a65c2f9eada6954b9cc 100644 |
| --- a/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py |
| +++ b/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py |
| @@ -214,34 +214,28 @@ class ChromeProxyMetric(network_metrics.NetworkMetric): |
| lo_fi_count = 0 |
| for resp in self.IterResponses(tab): |
| - if resp.HasChromeProxyViaHeader(): |
| + r = resp.response |
| + cl = resp.content_length |
|
sclittle
2015/03/24 17:32:46
Just use resp.response.url and resp.content_length
megjablon
2015/03/24 18:05:18
Done.
|
| + |
| + if resp.HasChromeProxyLoFi(): |
| lo_fi_count += 1 |
| else: |
| - r = resp.response |
| raise ChromeProxyMetricException, ( |
| '%s: LoFi not in request header.' % (r.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: |
| raise ChromeProxyMetricException, ( |
| 'Image %s is %d bytes. Expecting less than 100 bytes.' % |
| - (resource, cl)) |
| + (r.url, cl)) |
| + |
| + 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 |