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

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

Issue 2206363002: Added integration test to Chrome Proxy to verify direct connection on remote site timeout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added integration test to Chrome Proxy to verify direct connection on remote site timeout 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 AddResultsForBypassOnTimeout(self, tab, results):
876 bypass_count = 0
877 tab.WaitForDocumentReadyStateToBeComplete(timeout=30)
sclittle 2016/08/09 21:31:31 Is 30s long enough? Doesn't the origin site (e.g.
Robert Ogden 2016/08/09 21:56:22 Comment added. 30 seconds comes out of a concern f
sclittle 2016/08/09 22:12:03 I'm worried about the negative case, e.g. what has
Robert Ogden 2016/08/09 22:17:55 Good point. I'll make it 90 second timeout
878 for resp in self.IterResponses(tab):
879 if resp.HasChromeProxyViaHeader() and not resp.response.url.endswith(
880 'favicon.ico'):
881 r = resp.response
882 raise ChromeProxyMetricException, (
883 'Response for %s should not have via header after HTTP timeout.\n'
884 'Reponse: status=(%d)\nHeaders:\n %s' % (
885 r.url, r.status, r.headers))
886 elif not resp.response.url.endswith('favicon.ico'):
887 bypass_count += 1
888 if bypass_count == 0:
889 raise ChromeProxyMetricException('No pages were tested!')
890 results.AddValue(scalar.ScalarValue(
891 results.current_page, 'bypass', 'count', bypass_count))
892
875 PROXIED = 'proxied' 893 PROXIED = 'proxied'
876 DIRECT = 'direct' 894 DIRECT = 'direct'
877 895
878 896
879 class ChromeProxyVideoMetric(network_metrics.NetworkMetric): 897 class ChromeProxyVideoMetric(network_metrics.NetworkMetric):
880 """Metrics for video pages. 898 """Metrics for video pages.
881 899
882 Wraps the video metrics produced by videowrapper.js, such as the video 900 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 901 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. 902 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: 1015 except KeyError:
998 raise ChromeProxyMetricException, 'No metrics found' 1016 raise ChromeProxyMetricException, 'No metrics found'
999 1017
1000 # Returns whether |url| is a block-once test URL. Data Reduction Proxy has been 1018 # Returns whether |url| is a block-once test URL. Data Reduction Proxy has been
1001 # configured to always return block-once for these URLs. 1019 # configured to always return block-once for these URLs.
1002 def IsTestUrlForBlockOnce(url): 1020 def IsTestUrlForBlockOnce(url):
1003 return (url == 'http://check.googlezip.net/blocksingle/' or 1021 return (url == 'http://check.googlezip.net/blocksingle/' or
1004 url == ('http://chromeproxy-test.appspot.com/default?respBody=T0s=' 1022 url == ('http://chromeproxy-test.appspot.com/default?respBody=T0s='
1005 '&respHeader=eyJBY2Nlc3MtQ29udHJvbC1BbGxvdy1PcmlnaW4iOlsiKiJ' 1023 '&respHeader=eyJBY2Nlc3MtQ29udHJvbC1BbGxvdy1PcmlnaW4iOlsiKiJ'
1006 'dfQ==&respStatus=200&flywheelAction=block-once')) 1024 'dfQ==&respStatus=200&flywheelAction=block-once'))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698