Chromium Code Reviews| 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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 865 'Expected 1 pingback success and no failures, but ' | 865 'Expected 1 pingback success and no failures, but ' |
| 866 'there were %d succesful pingbacks and %d failed pingback attempts' | 866 'there were %d succesful pingbacks and %d failed pingback attempts' |
| 867 % (succeeded, count - succeeded)) | 867 % (succeeded, count - succeeded)) |
| 868 results.AddValue(scalar.ScalarValue( | 868 results.AddValue(scalar.ScalarValue( |
| 869 results.current_page, 'attempted', 'count', attempted)) | 869 results.current_page, 'attempted', 'count', attempted)) |
| 870 results.AddValue(scalar.ScalarValue( | 870 results.AddValue(scalar.ScalarValue( |
| 871 results.current_page, 'succeeded_count', 'count', count)) | 871 results.current_page, 'succeeded_count', 'count', count)) |
| 872 results.AddValue(scalar.ScalarValue( | 872 results.AddValue(scalar.ScalarValue( |
| 873 results.current_page, 'succeeded_sum', 'count', succeeded)) | 873 results.current_page, 'succeeded_sum', 'count', succeeded)) |
| 874 | 874 |
| 875 def AddResultsForClientBypassOnTimeout(self, tab, results): | |
| 876 bypass_count = 0 | |
| 877 via_count = 0 | |
| 878 tab.WaitForDocumentReadyStateToBeComplete(timeout=30) | |
| 879 for resp in self.IterResponses(tab): | |
| 880 if resp.HasChromeProxyViaHeader(): | |
| 881 via_count += 1 | |
|
bustamante
2016/08/03 19:04:39
You probably don't need to keep track of via_count
Robert Ogden
2016/08/03 21:12:32
Done.
| |
| 882 r = resp.response | |
| 883 raise ChromeProxyMetricException, ( | |
| 884 'Response for %s should not have via header after proxy timeout.\n' | |
| 885 'Reponse: status=(%d, %s)\nHeaders:\n %s' % ( | |
| 886 r.url, r.status, r.status_text, r.headers)) | |
| 887 else: | |
| 888 bypass_count += 1 | |
| 889 results.AddValue(scalar.ScalarValue( | |
|
bustamante
2016/08/03 19:04:39
It's worth adding a check to verify that bypass_co
Robert Ogden
2016/08/03 21:12:32
Done.
| |
| 890 results.current_page, 'bypass', 'count', bypass_count)) | |
| 891 results.AddValue(scalar.ScalarValue( | |
| 892 results.current_page, 'via', 'count', via_count)) | |
| 893 | |
| 875 PROXIED = 'proxied' | 894 PROXIED = 'proxied' |
| 876 DIRECT = 'direct' | 895 DIRECT = 'direct' |
| 877 | 896 |
| 878 | 897 |
| 879 class ChromeProxyVideoMetric(network_metrics.NetworkMetric): | 898 class ChromeProxyVideoMetric(network_metrics.NetworkMetric): |
| 880 """Metrics for video pages. | 899 """Metrics for video pages. |
| 881 | 900 |
| 882 Wraps the video metrics produced by videowrapper.js, such as the video | 901 Wraps the video metrics produced by videowrapper.js, such as the video |
| 883 duration and size in pixels. Also checks a few basic HTTP response headers | 902 duration and size in pixels. Also checks a few basic HTTP response headers |
| 884 such as Content-Type and Content-Length in the video responses. | 903 such as Content-Type and Content-Length in the video responses. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 997 except KeyError: | 1016 except KeyError: |
| 998 raise ChromeProxyMetricException, 'No metrics found' | 1017 raise ChromeProxyMetricException, 'No metrics found' |
| 999 | 1018 |
| 1000 # Returns whether |url| is a block-once test URL. Data Reduction Proxy has been | 1019 # Returns whether |url| is a block-once test URL. Data Reduction Proxy has been |
| 1001 # configured to always return block-once for these URLs. | 1020 # configured to always return block-once for these URLs. |
| 1002 def IsTestUrlForBlockOnce(url): | 1021 def IsTestUrlForBlockOnce(url): |
| 1003 return (url == 'http://check.googlezip.net/blocksingle/' or | 1022 return (url == 'http://check.googlezip.net/blocksingle/' or |
| 1004 url == ('http://chromeproxy-test.appspot.com/default?respBody=T0s=' | 1023 url == ('http://chromeproxy-test.appspot.com/default?respBody=T0s=' |
| 1005 '&respHeader=eyJBY2Nlc3MtQ29udHJvbC1BbGxvdy1PcmlnaW4iOlsiKiJ' | 1024 '&respHeader=eyJBY2Nlc3MtQ29udHJvbC1BbGxvdy1PcmlnaW4iOlsiKiJ' |
| 1006 'dfQ==&respStatus=200&flywheelAction=block-once')) | 1025 'dfQ==&respStatus=200&flywheelAction=block-once')) |
| OLD | NEW |