OLD | NEW |
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 integration_tests import network_metrics | 8 from integration_tests 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 bypass_for_client_type): | 252 bypass_for_client_type): |
253 via_count = 0 | 253 via_count = 0 |
254 bypass_count = 0 | 254 bypass_count = 0 |
255 | 255 |
256 for resp in self.IterResponses(tab): | 256 for resp in self.IterResponses(tab): |
257 if resp.HasChromeProxyViaHeader(): | 257 if resp.HasChromeProxyViaHeader(): |
258 via_count += 1 | 258 via_count += 1 |
259 if client_type.lower() == bypass_for_client_type.lower(): | 259 if client_type.lower() == bypass_for_client_type.lower(): |
260 raise ChromeProxyMetricException, ( | 260 raise ChromeProxyMetricException, ( |
261 '%s: Response for client of type "%s" has via header, but should ' | 261 '%s: Response for client of type "%s" has via header, but should ' |
262 'be bypassed.' % ( | 262 'be bypassed.' % (resp.response.url, bypass_for_client_type)) |
263 resp.response.url, bypass_for_client_type, client_type)) | |
264 elif resp.ShouldHaveChromeProxyViaHeader(): | 263 elif resp.ShouldHaveChromeProxyViaHeader(): |
265 bypass_count += 1 | 264 bypass_count += 1 |
266 if client_type.lower() != bypass_for_client_type.lower(): | 265 if client_type.lower() != bypass_for_client_type.lower(): |
267 raise ChromeProxyMetricException, ( | 266 raise ChromeProxyMetricException, ( |
268 '%s: Response missing via header. Only "%s" clients should ' | 267 '%s: Response missing via header. Only "%s" clients should ' |
269 'bypass for this page, but this client is "%s".' % ( | 268 'bypass for this page, but this client is "%s".' % ( |
270 resp.response.url, bypass_for_client_type, client_type)) | 269 resp.response.url, bypass_for_client_type, client_type)) |
271 | 270 |
272 if via_count + bypass_count == 0: | 271 if via_count + bypass_count == 0: |
273 raise ChromeProxyMetricException, ( | 272 raise ChromeProxyMetricException, ( |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 via_count += 1 | 551 via_count += 1 |
553 if via_count == 0: | 552 if via_count == 0: |
554 raise ChromeProxyMetricException, ( | 553 raise ChromeProxyMetricException, ( |
555 'Expected at least one response through the proxy after the bypass ' | 554 'Expected at least one response through the proxy after the bypass ' |
556 'expired, but zero such responses were received.') | 555 'expired, but zero such responses were received.') |
557 | 556 |
558 results.AddValue(scalar.ScalarValue( | 557 results.AddValue(scalar.ScalarValue( |
559 results.current_page, 'bypass', 'count', bypass_count)) | 558 results.current_page, 'bypass', 'count', bypass_count)) |
560 results.AddValue(scalar.ScalarValue( | 559 results.AddValue(scalar.ScalarValue( |
561 results.current_page, 'via', 'count', via_count)) | 560 results.current_page, 'via', 'count', via_count)) |
OLD | NEW |