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

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

Issue 998163005: LoFi integration test should use HasChromeProxyLoFi (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 5 years, 9 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 | « no previous file | 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 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698