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

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: 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
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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 AddResultsForBadHTTPSFallback(self, tab, results):
876 via_count = 0
877 tab.WaitForDocumentReadyStateToBeComplete(timeout=30)
878 for resp in self.IterResponses(tab):
879 if resp.HasChromeProxyViaHeader() and (resp.remote_port == 80
880 or resp.remote_port == None):
881 via_count += 1
882 else:
883 r = resp.response
884 raise ChromeProxyMetricException, (
885 'Response for %s should have via header and be on port 80 after '
886 'bad proxy HTTPS response.\nReponse: status=(%d)\nport=(%d)\n'
887 'Headers:\n %s' % (
888 r.url, r.status, resp.remote_port, r.headers))
889 if via_count == 0:
890 raise ChromeProxyMetricException('No pages were tested!')
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
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'))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698