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

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

Issue 2357723002: Add integration tests for QUIC (Closed)
Patch Set: ps Created 4 years, 3 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 json
5 import logging 6 import logging
6 import os 7 import os
7 import time 8 import time
8 9
9 from common import chrome_proxy_metrics 10 from common import chrome_proxy_metrics
10 from common import network_metrics 11 from common import network_metrics
11 from common.chrome_proxy_metrics import ChromeProxyMetricException 12 from common.chrome_proxy_metrics import ChromeProxyMetricException
12 from telemetry.page import page_test 13 from telemetry.page import page_test
13 from telemetry.value import scalar 14 from telemetry.value import scalar
14 from telemetry.value import histogram_util 15 from telemetry.value import histogram_util
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 'Expected 1 pingback success and no failures, but ' 866 'Expected 1 pingback success and no failures, but '
866 'there were %d succesful pingbacks and %d failed pingback attempts' 867 'there were %d succesful pingbacks and %d failed pingback attempts'
867 % (succeeded, count - succeeded)) 868 % (succeeded, count - succeeded))
868 results.AddValue(scalar.ScalarValue( 869 results.AddValue(scalar.ScalarValue(
869 results.current_page, 'attempted', 'count', attempted)) 870 results.current_page, 'attempted', 'count', attempted))
870 results.AddValue(scalar.ScalarValue( 871 results.AddValue(scalar.ScalarValue(
871 results.current_page, 'succeeded_count', 'count', count)) 872 results.current_page, 'succeeded_count', 'count', count))
872 results.AddValue(scalar.ScalarValue( 873 results.AddValue(scalar.ScalarValue(
873 results.current_page, 'succeeded_sum', 'count', succeeded)) 874 results.current_page, 'succeeded_sum', 'count', succeeded))
874 875
876 def AddResultsForQuicTransaction(self, tab, results):
877 histogram_type = histogram_util.BROWSER_HISTOGRAM
878 # This histogram should be synchronously created when the Navigate occurs.
879 # Verify that histogram DataReductionProxy.Quic.ProxyStatus has no samples
880 # in bucket >=1.
881 fail_counts_proxy_status = histogram_util.GetHistogramSum(
882 histogram_type,
883 'DataReductionProxy.Quic.ProxyStatus',
884 tab)
885 if fail_counts_proxy_status != 0:
886 raise ChromeProxyMetricException, (
887 'fail_counts_proxy_status is %d.' % fail_counts_proxy_status)
888
889 # Verify that histogram DataReductionProxy.Quic.ProxyStatus has at least 1
890 # sample. This sample must be in bucket 0 (QUIC_PROXY_STATUS_AVAILABLE).
891 success_counts_proxy_status = histogram_util.GetHistogramCount(
892 histogram_type,
893 'DataReductionProxy.Quic.ProxyStatus',
894 tab)
895 if success_counts_proxy_status <= 0:
896 raise ChromeProxyMetricException, (
897 'success_counts_proxy_status is %d.' % success_counts_proxy_status)
898
899 # Navigate to one more page to ensure that established QUIC connection
900 # is used for the next request.
901 time.sleep(3)
RyanSturm 2016/09/21 18:54:39 Can you add a comment on why this sleep is 3 and w
tbansal1 2016/09/22 17:25:42 Done.
902 tab.Navigate('http://check.googlezip.net/test.html')
903
904 proxy_usage_histogram_json = histogram_util.GetHistogram(histogram_type,
905 'Net.QuicAlternativeProxy.Usage',
906 tab)
907 proxy_usage_histogram = json.loads(proxy_usage_histogram_json)
908
909 # Bucket ALTERNATIVE_PROXY_USAGE_NO_RACE should have at least one sample.
910 if proxy_usage_histogram['buckets'][0]['count'] <= 0:
911 raise ChromeProxyMetricException, (
912 'Number of samples in ALTERNATIVE_PROXY_USAGE_NO_RACE bucket is %d.'
913 % proxy_usage_histogram['buckets'][0]['count'])
914
915 results.AddValue(scalar.ScalarValue(
916 results.current_page, 'fail_counts_proxy_status', 'count',
917 fail_counts_proxy_status))
918 results.AddValue(scalar.ScalarValue(
919 results.current_page, 'success_counts_proxy_status', 'count',
920 success_counts_proxy_status))
921
875 def AddResultsForBypassOnTimeout(self, tab, results): 922 def AddResultsForBypassOnTimeout(self, tab, results):
876 bypass_count = 0 923 bypass_count = 0
877 # Wait maximum of 120 seconds for test to complete. Should complete soon 924 # Wait maximum of 120 seconds for test to complete. Should complete soon
878 # after 90 second test server delay in case of failure, and much sooner in 925 # after 90 second test server delay in case of failure, and much sooner in
879 # case of success. 926 # case of success.
880 tab.WaitForDocumentReadyStateToBeComplete(timeout=120) 927 tab.WaitForDocumentReadyStateToBeComplete(timeout=120)
881 for resp in self.IterResponses(tab): 928 for resp in self.IterResponses(tab):
882 if resp.HasChromeProxyViaHeader() and not resp.response.url.endswith( 929 if resp.HasChromeProxyViaHeader() and not resp.response.url.endswith(
883 'favicon.ico'): 930 'favicon.ico'):
884 r = resp.response 931 r = resp.response
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 except KeyError: 1084 except KeyError:
1038 raise ChromeProxyMetricException, 'No metrics found' 1085 raise ChromeProxyMetricException, 'No metrics found'
1039 1086
1040 # Returns whether |url| is a block-once test URL. Data Reduction Proxy has been 1087 # Returns whether |url| is a block-once test URL. Data Reduction Proxy has been
1041 # configured to always return block-once for these URLs. 1088 # configured to always return block-once for these URLs.
1042 def IsTestUrlForBlockOnce(url): 1089 def IsTestUrlForBlockOnce(url):
1043 return (url == 'http://check.googlezip.net/blocksingle/' or 1090 return (url == 'http://check.googlezip.net/blocksingle/' or
1044 url == ('http://chromeproxy-test.appspot.com/default?respBody=T0s=' 1091 url == ('http://chromeproxy-test.appspot.com/default?respBody=T0s='
1045 '&respHeader=eyJBY2Nlc3MtQ29udHJvbC1BbGxvdy1PcmlnaW4iOlsiKiJ' 1092 '&respHeader=eyJBY2Nlc3MtQ29udHJvbC1BbGxvdy1PcmlnaW4iOlsiKiJ'
1046 'dfQ==&respStatus=200&flywheelAction=block-once')) 1093 'dfQ==&respStatus=200&flywheelAction=block-once'))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698