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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 return None 71 return None
72 72
73 chrome_proxy_request_header = self.response.request_headers['Chrome-Proxy'] 73 chrome_proxy_request_header = self.response.request_headers['Chrome-Proxy']
74 values = [v.strip() for v in chrome_proxy_request_header.split(',')] 74 values = [v.strip() for v in chrome_proxy_request_header.split(',')]
75 for value in values: 75 for value in values:
76 kvp = value.split('=', 1) 76 kvp = value.split('=', 1)
77 if len(kvp) == 2 and kvp[0].strip() == 'c': 77 if len(kvp) == 2 and kvp[0].strip() == 'c':
78 return kvp[1].strip() 78 return kvp[1].strip()
79 return None 79 return None
80 80
81 def HasChromeProxyLoFi(self): 81 def HasChromeProxyLoFiRequest(self):
82 if 'Chrome-Proxy' not in self.response.request_headers: 82 if 'Chrome-Proxy' not in self.response.request_headers:
83 return False 83 return False
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 for value in values: 86 return any(v == "q=low" for v in values)
87 if len(value) == 5 and value == 'q=low': 87
88 return True 88 def HasChromeProxyLoFiResponse(self):
89 return False 89 chrome_proxy_response_header = self.response.GetHeader('Chrome-Proxy')
90 if not chrome_proxy_response_header:
91 return False
92 values = [v.strip() for v in chrome_proxy_response_header.split(',')]
93 return any(v == "q=low" for v in values)
OLDNEW
« 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