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

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

Issue 2905423002: Do not attempt to use data reduction proxy when holdback is enabled (Closed)
Patch Set: Created 3 years, 7 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_delegate_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc
index 462c92b0f652bb0540dd2b7eaf8977d69b6e9f16..5c4f2c15a4a6e9e4a3ae02c7cd3beb79070d1b22 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc
@@ -860,6 +860,36 @@ TEST_F(DataReductionProxyDelegateTest, TimeToFirstHttpDataSaverRequest) {
}
}
+TEST_F(DataReductionProxyDelegateTest, Holdback) {
+ const char kResponseHeaders[] =
+ "HTTP/1.1 200 OK\r\n"
+ "Via: 1.1 Chrome-Compression-Proxy-Suffix\r\n"
+ "Content-Length: 10\r\n\r\n";
+
+ const struct {
+ bool holdback;
+ } tests[] = {
+ {
+ true,
+ },
+ {
+ false,
+ },
+ };
+ for (const auto& test : tests) {
+ base::FieldTrialList field_trial_list(nullptr);
+ ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
+ "DataCompressionProxyHoldback", test.holdback ? "Enabled" : "Control"));
+
+ base::HistogramTester histogram_tester;
+ FetchURLRequest(GURL("http://example.com/path/"), nullptr, kResponseHeaders,
+ 10);
+ histogram_tester.ExpectTotalCount(
+ "DataReductionProxy.SuccessfulRequestCompletionCounts",
+ test.holdback ? 0 : 1);
+ }
+}
+
TEST_F(DataReductionProxyDelegateTest, OnCompletedSizeFor304) {
int64_t baseline_received_bytes = total_received_bytes();
int64_t baseline_original_received_bytes = total_original_received_bytes();

Powered by Google App Engine
This is Rietveld 408576698