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 os | 6 import os |
7 import time | 7 import time |
8 | 8 |
9 from common import chrome_proxy_metrics | 9 from common import chrome_proxy_metrics |
10 from common import network_metrics | 10 from common import network_metrics |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 if via_proxy == 0: | 410 if via_proxy == 0: |
411 raise ChromeProxyMetricException, ( | 411 raise ChromeProxyMetricException, ( |
412 'None of the requests went via data reduction proxy') | 412 'None of the requests went via data reduction proxy') |
413 | 413 |
414 if (eligible_response_count != 2): | 414 if (eligible_response_count != 2): |
415 raise ChromeProxyMetricException, ( | 415 raise ChromeProxyMetricException, ( |
416 'Did not make expected number of requests to whitelisted block-once' | 416 'Did not make expected number of requests to whitelisted block-once' |
417 ' test URLs. Expected: 2, Actual: ' + str(eligible_response_count)) | 417 ' test URLs. Expected: 2, Actual: ' + str(eligible_response_count)) |
418 | 418 |
419 results.AddValue(scalar.ScalarValue(results.current_page, | 419 results.AddValue(scalar.ScalarValue(results.current_page, |
420 'BlockOnce_success', 'num_eligible_response', 2)) | 420 'eligible_responses', 'count', 2)) |
421 | 421 |
422 | 422 |
423 def AddResultsForSafebrowsingOn(self, tab, results): | 423 def AddResultsForSafebrowsingOn(self, tab, results): |
424 results.AddValue(scalar.ScalarValue( | 424 results.AddValue(scalar.ScalarValue( |
425 results.current_page, 'safebrowsing', 'timeout responses', 1)) | 425 results.current_page, 'safebrowsing', 'timeout responses', 1)) |
426 | 426 |
427 def AddResultsForSafebrowsingOff(self, tab, results): | 427 def AddResultsForSafebrowsingOff(self, tab, results): |
428 response_count = 0 | 428 response_count = 0 |
429 for resp in self.IterResponses(tab): | 429 for resp in self.IterResponses(tab): |
430 # Data reduction proxy should return the real response for sites with | 430 # Data reduction proxy should return the real response for sites with |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 if failed: | 740 if failed: |
741 raise ChromeProxyMetricException, 'failed' | 741 raise ChromeProxyMetricException, 'failed' |
742 except KeyError: | 742 except KeyError: |
743 raise ChromeProxyMetricException, 'No metrics found' | 743 raise ChromeProxyMetricException, 'No metrics found' |
744 | 744 |
745 # Returns whether |url| is a block-once test URL. Data Reduction Proxy has been | 745 # Returns whether |url| is a block-once test URL. Data Reduction Proxy has been |
746 # configured to always return block-once for these URLs. | 746 # configured to always return block-once for these URLs. |
747 def IsTestUrlForBlockOnce(url): | 747 def IsTestUrlForBlockOnce(url): |
748 return (url == 'http://check.googlezip.net/blocksingle/' or | 748 return (url == 'http://check.googlezip.net/blocksingle/' or |
749 url == 'http://chromeproxy-test.appspot.com/default?respBody=T0s=&respStat
us=200&flywheelAction=block-once') | 749 url == 'http://chromeproxy-test.appspot.com/default?respBody=T0s=&respStat
us=200&flywheelAction=block-once') |
OLD | NEW |