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

Unified Diff: tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py

Issue 2357723002: Add integration tests for QUIC (Closed)
Patch Set: Addressed comments 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 side-by-side diff with in-line comments
Download patch
Index: tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py
diff --git a/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py b/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py
index 70051f854cfb03f718e6bd9a5ccb0c96f8ef5a58..ee2b103ccac1c29e6ac65733fda017dc6c1aebd7 100644
--- a/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py
+++ b/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import json
import logging
import os
import time
@@ -872,6 +873,53 @@ class ChromeProxyMetric(network_metrics.NetworkMetric):
results.AddValue(scalar.ScalarValue(
results.current_page, 'succeeded_sum', 'count', succeeded))
+ def AddResultsForQuicTransaction(self, tab, results):
+ histogram_type = histogram_util.BROWSER_HISTOGRAM
+ # This histogram should be synchronously created when the Navigate occurs.
+ # Verify that histogram DataReductionProxy.Quic.ProxyStatus has no samples
+ # in bucket >=1.
+ fail_counts_proxy_status = histogram_util.GetHistogramSum(
+ histogram_type,
+ 'DataReductionProxy.Quic.ProxyStatus',
+ tab)
+ if fail_counts_proxy_status != 0:
+ raise ChromeProxyMetricException, (
+ 'fail_counts_proxy_status is %d.' % fail_counts_proxy_status)
+
+ # Verify that histogram DataReductionProxy.Quic.ProxyStatus has at least 1
+ # sample. This sample must be in bucket 0 (QUIC_PROXY_STATUS_AVAILABLE).
+ success_counts_proxy_status = histogram_util.GetHistogramCount(
+ histogram_type,
+ 'DataReductionProxy.Quic.ProxyStatus',
+ tab)
+ if success_counts_proxy_status <= 0:
+ raise ChromeProxyMetricException, (
+ 'success_counts_proxy_status is %d.' % success_counts_proxy_status)
+
+ # Navigate to one more page to ensure that established QUIC connection
+ # is used for the next request. Give 1 second extra headroom for the QUIC
+ # connection to be established.
+ time.sleep(1)
+ tab.Navigate('http://check.googlezip.net/test.html')
+
+ proxy_usage_histogram_json = histogram_util.GetHistogram(histogram_type,
+ 'Net.QuicAlternativeProxy.Usage',
+ tab)
+ proxy_usage_histogram = json.loads(proxy_usage_histogram_json)
+
+ # Bucket ALTERNATIVE_PROXY_USAGE_NO_RACE should have at least one sample.
+ if proxy_usage_histogram['buckets'][0]['count'] <= 0:
+ raise ChromeProxyMetricException, (
+ 'Number of samples in ALTERNATIVE_PROXY_USAGE_NO_RACE bucket is %d.'
+ % proxy_usage_histogram['buckets'][0]['count'])
+
+ results.AddValue(scalar.ScalarValue(
+ results.current_page, 'fail_counts_proxy_status', 'count',
+ fail_counts_proxy_status))
+ results.AddValue(scalar.ScalarValue(
+ results.current_page, 'success_counts_proxy_status', 'count',
+ success_counts_proxy_status))
+
def AddResultsForBypassOnTimeout(self, tab, results):
bypass_count = 0
# Wait maximum of 120 seconds for test to complete. Should complete soon

Powered by Google App Engine
This is Rietveld 408576698