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

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

Issue 1550973002: Fix broken chrome_proxy unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix lint issues Created 5 years 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
« no previous file with comments | « tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/chrome_proxy/integration_tests/chrome_proxy_metrics_unittest.py
diff --git a/tools/chrome_proxy/integration_tests/chrome_proxy_metrics_unittest.py b/tools/chrome_proxy/integration_tests/chrome_proxy_metrics_unittest.py
index 3b2240bd9ce2ab0a64929d2628020c03fc271bc5..16ed6404b9bc73d6af6d67b5efa48b8fd9425d90 100644
--- a/tools/chrome_proxy/integration_tests/chrome_proxy_metrics_unittest.py
+++ b/tools/chrome_proxy/integration_tests/chrome_proxy_metrics_unittest.py
@@ -22,6 +22,16 @@ EVENT_HTML_DIRECT = network_unittest.NetworkMetricTest.MakeNetworkTimelineEvent(
},
body=network_unittest.HTML_BODY)
+# A BlockOnce response not via proxy.
+EVENT_HTML_BLOCKONCE = (
+ network_unittest.NetworkMetricTest.MakeNetworkTimelineEvent(
+ url='http://check.googlezip.net/blocksingle/',
+ response_headers={
+ 'Content-Type': 'text/html',
+ 'Content-Length': str(len(network_unittest.HTML_BODY)),
+ },
+ body=network_unittest.HTML_BODY))
+
# An HTML via proxy.
EVENT_HTML_PROXY_VIA = (
network_unittest.NetworkMetricTest.MakeNetworkTimelineEvent(
@@ -264,14 +274,15 @@ class ChromeProxyMetricTest(unittest.TestCase):
def testChromeProxyMetricForBlockOnce(self):
metric = metrics.ChromeProxyMetric()
- metric.SetEvents([EVENT_HTML_DIRECT,
+ metric.SetEvents([EVENT_HTML_BLOCKONCE,
+ EVENT_HTML_BLOCKONCE,
EVENT_IMAGE_PROXY_VIA])
results = test_page_test_results.TestPageTestResults(self)
metric.AddResultsForBlockOnce(None, results)
results.AssertHasPageSpecificScalarValue('eligible_responses', 'count', 2)
- results.AssertHasPageSpecificScalarValue('bypass', 'count', 1)
- metric.SetEvents([EVENT_HTML_DIRECT,
+ metric.SetEvents([EVENT_HTML_BLOCKONCE,
+ EVENT_HTML_BLOCKONCE,
EVENT_IMAGE_DIRECT])
exception_occurred = False
try:
« no previous file with comments | « tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698