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

Side by Side Diff: tools/chrome_proxy/common/chrome_proxy_metrics.py

Issue 1151753003: Integration test for Chrome-Proxy: pass-through directive (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@loFiSnackbar
Patch Set: 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 import time 6 import time
7 7
8 from common import network_metrics 8 from common import network_metrics
9 from telemetry.page import page_test 9 from telemetry.page import page_test
10 from telemetry.value import scalar 10 from telemetry.value import scalar
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 chrome_proxy_request_header = self.response.request_headers['Chrome-Proxy'] 84 chrome_proxy_request_header = self.response.request_headers['Chrome-Proxy']
85 values = [v.strip() for v in chrome_proxy_request_header.split(',')] 85 values = [v.strip() for v in chrome_proxy_request_header.split(',')]
86 return any(v == "q=low" for v in values) 86 return any(v == "q=low" for v in values)
87 87
88 def HasChromeProxyLoFiResponse(self): 88 def HasChromeProxyLoFiResponse(self):
89 chrome_proxy_response_header = self.response.GetHeader('Chrome-Proxy') 89 chrome_proxy_response_header = self.response.GetHeader('Chrome-Proxy')
90 if not chrome_proxy_response_header: 90 if not chrome_proxy_response_header:
91 return False 91 return False
92 values = [v.strip() for v in chrome_proxy_response_header.split(',')] 92 values = [v.strip() for v in chrome_proxy_response_header.split(',')]
93 return any(v == "q=low" for v in values) 93 return any(v == "q=low" for v in values)
94
95 def HasChromeProxyPassThroughRequest(self):
96 if 'Chrome-Proxy' not in self.response.request_headers:
97 return False
98 chrome_proxy_request_header = self.response.request_headers['Chrome-Proxy']
sclittle 2015/05/21 01:54:24 This code to extract a value from a header seems t
megjablon 2015/05/21 19:03:07 WDYT?
sclittle 2015/05/21 19:28:56 Looks good, thanks!
99 values = [v.strip() for v in chrome_proxy_request_header.split(',')]
100 return any(v == "pass-through" for v in values)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698