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

Unified Diff: tools/chrome_proxy/common/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 | « no previous file | tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/chrome_proxy/common/chrome_proxy_metrics.py
diff --git a/tools/chrome_proxy/common/chrome_proxy_metrics.py b/tools/chrome_proxy/common/chrome_proxy_metrics.py
index f28cbb8364ce3e94cf33fd47191eebea3c9f8b10..46c7ed89d80d4bd32977437d73e716b5c2ee5784 100644
--- a/tools/chrome_proxy/common/chrome_proxy_metrics.py
+++ b/tools/chrome_proxy/common/chrome_proxy_metrics.py
@@ -78,12 +78,16 @@ class ChromeProxyResponse(network_metrics.HTTPResponse):
return kvp[1].strip()
return None
- def HasChromeProxyLoFi(self):
+ def HasChromeProxyLoFiRequest(self):
if 'Chrome-Proxy' not in self.response.request_headers:
return False
chrome_proxy_request_header = self.response.request_headers['Chrome-Proxy']
values = [v.strip() for v in chrome_proxy_request_header.split(',')]
- for value in values:
- if len(value) == 5 and value == 'q=low':
- return True
- return False
+ return any(v == "q=low" for v in values)
+
+ def HasChromeProxyLoFiResponse(self):
+ chrome_proxy_response_header = self.response.GetHeader('Chrome-Proxy')
+ if not chrome_proxy_response_header:
+ return False
+ values = [v.strip() for v in chrome_proxy_response_header.split(',')]
+ return any(v == "q=low" for v in values)
« no previous file with comments | « no previous file | tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698