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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc

Issue 1048303004: Added new BypassedBytes.Current histograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 5 years, 9 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: components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc
index e30666217995a508052d1179803e8ecc06f9b24c..c0a47414e9cf7188f59909a32972866e8cba60e0 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc
@@ -658,6 +658,8 @@ class DataReductionProxyBypassStatsEndToEndTest : public testing::Test {
"DataReductionProxy.BypassedBytes.LocalBypassRules",
"DataReductionProxy.BypassedBytes.ProxyOverridden",
"DataReductionProxy.BypassedBytes.Current",
+ "DataReductionProxy.BypassedBytes.CurrentAudioVideo",
+ "DataReductionProxy.BypassedBytes.CurrentApplicationOctetStream",
"DataReductionProxy.BypassedBytes.ShortAll",
"DataReductionProxy.BypassedBytes.ShortTriggeringRequest",
"DataReductionProxy.BypassedBytes.ShortAudioVideo",
@@ -765,18 +767,34 @@ TEST_F(DataReductionProxyBypassStatsEndToEndTest,
TEST_F(DataReductionProxyBypassStatsEndToEndTest, BypassedBytesCurrent) {
InitializeContext();
- base::HistogramTester histogram_tester;
- CreateAndExecuteRequest(GURL("http://foo.com"),
- "HTTP/1.1 502 Bad Gateway\r\n"
- "Via: 1.1 Chrome-Compression-Proxy\r\n"
- "Chrome-Proxy: block-once\r\n\r\n",
- kErrorBody.c_str(), "HTTP/1.1 200 OK\r\n\r\n",
- kBody.c_str());
+ struct TestCase {
+ const char* histogram_name;
+ const char* retry_response_headers;
+ };
+ const TestCase test_cases[] = {
+ {"DataReductionProxy.BypassedBytes.Current", "HTTP/1.1 200 OK\r\n\r\n"},
+ {"DataReductionProxy.BypassedBytes.CurrentAudioVideo",
+ "HTTP/1.1 200 OK\r\n"
+ "Content-Type: video/mp4\r\n\r\n"},
+ {"DataReductionProxy.BypassedBytes.CurrentApplicationOctetStream",
+ "HTTP/1.1 200 OK\r\n"
+ "Content-Type: application/octet-stream\r\n\r\n"},
+ };
+ for (const TestCase& test_case : test_cases) {
+ ClearBadProxies();
+ base::HistogramTester histogram_tester;
+ CreateAndExecuteRequest(GURL("http://foo.com"),
+ "HTTP/1.1 502 Bad Gateway\r\n"
+ "Via: 1.1 Chrome-Compression-Proxy\r\n"
+ "Chrome-Proxy: block-once\r\n\r\n",
+ kErrorBody.c_str(),
+ test_case.retry_response_headers, kBody.c_str());
- histogram_tester.ExpectUniqueSample(
- "DataReductionProxy.BypassedBytes.Current", kBody.size(), 1);
- ExpectOtherBypassedBytesHistogramsEmpty(
- histogram_tester, "DataReductionProxy.BypassedBytes.Current");
+ histogram_tester.ExpectUniqueSample(test_case.histogram_name, kBody.size(),
+ 1);
+ ExpectOtherBypassedBytesHistogramsEmpty(histogram_tester,
+ test_case.histogram_name);
+ }
}
TEST_F(DataReductionProxyBypassStatsEndToEndTest,

Powered by Google App Engine
This is Rietveld 408576698