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

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

Issue 2227163002: Added integration test to Chrome Proxy to verify fallback to HTTP after bad HTTPS response from pro… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Uses SyntheticStorySet instead now Created 4 years, 4 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 | « tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py ('k') | no next file » | 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 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 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 'Response for %s should not have via header after HTTP timeout.\n' 886 'Response for %s should not have via header after HTTP timeout.\n'
887 'Reponse: status=(%d)\nHeaders:\n %s' % ( 887 'Reponse: status=(%d)\nHeaders:\n %s' % (
888 r.url, r.status, r.headers)) 888 r.url, r.status, r.headers))
889 elif not resp.response.url.endswith('favicon.ico'): 889 elif not resp.response.url.endswith('favicon.ico'):
890 bypass_count += 1 890 bypass_count += 1
891 if bypass_count == 0: 891 if bypass_count == 0:
892 raise ChromeProxyMetricException('No pages were tested!') 892 raise ChromeProxyMetricException('No pages were tested!')
893 results.AddValue(scalar.ScalarValue( 893 results.AddValue(scalar.ScalarValue(
894 results.current_page, 'bypass', 'count', bypass_count)) 894 results.current_page, 'bypass', 'count', bypass_count))
895 895
896 def AddResultsForBadHTTPSFallback(self, tab, results):
897 via_count = 0
898 tab.WaitForDocumentReadyStateToBeComplete(timeout=30)
899 for resp in self.IterResponses(tab):
900 if resp.HasChromeProxyViaHeader() and (resp.remote_port == 80
901 or resp.remote_port == None):
902 via_count += 1
903 else:
904 r = resp.response
905 raise ChromeProxyMetricException, (
906 'Response for %s should have via header and be on port 80 after '
907 'bad proxy HTTPS response.\nReponse: status=(%d)\nport=(%d)\n'
908 'Headers:\n %s' % (
909 r.url, r.status, resp.remote_port, r.headers))
910 if via_count == 0:
911 raise ChromeProxyMetricException('No pages were tested!')
912 results.AddValue(scalar.ScalarValue(
913 results.current_page, 'via', 'count', via_count))
914
896 PROXIED = 'proxied' 915 PROXIED = 'proxied'
897 DIRECT = 'direct' 916 DIRECT = 'direct'
898 917
899 918
900 class ChromeProxyVideoMetric(network_metrics.NetworkMetric): 919 class ChromeProxyVideoMetric(network_metrics.NetworkMetric):
901 """Metrics for video pages. 920 """Metrics for video pages.
902 921
903 Wraps the video metrics produced by videowrapper.js, such as the video 922 Wraps the video metrics produced by videowrapper.js, such as the video
904 duration and size in pixels. Also checks a few basic HTTP response headers 923 duration and size in pixels. Also checks a few basic HTTP response headers
905 such as Content-Type and Content-Length in the video responses. 924 such as Content-Type and Content-Length in the video responses.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 except KeyError: 1037 except KeyError:
1019 raise ChromeProxyMetricException, 'No metrics found' 1038 raise ChromeProxyMetricException, 'No metrics found'
1020 1039
1021 # Returns whether |url| is a block-once test URL. Data Reduction Proxy has been 1040 # Returns whether |url| is a block-once test URL. Data Reduction Proxy has been
1022 # configured to always return block-once for these URLs. 1041 # configured to always return block-once for these URLs.
1023 def IsTestUrlForBlockOnce(url): 1042 def IsTestUrlForBlockOnce(url):
1024 return (url == 'http://check.googlezip.net/blocksingle/' or 1043 return (url == 'http://check.googlezip.net/blocksingle/' or
1025 url == ('http://chromeproxy-test.appspot.com/default?respBody=T0s=' 1044 url == ('http://chromeproxy-test.appspot.com/default?respBody=T0s='
1026 '&respHeader=eyJBY2Nlc3MtQ29udHJvbC1BbGxvdy1PcmlnaW4iOlsiKiJ' 1045 '&respHeader=eyJBY2Nlc3MtQ29udHJvbC1BbGxvdy1PcmlnaW4iOlsiKiJ'
1027 'dfQ==&respStatus=200&flywheelAction=block-once')) 1046 'dfQ==&respStatus=200&flywheelAction=block-once'))
OLDNEW
« no previous file with comments | « tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698