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

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

Issue 2956703002: Adds Server Previews protocol UMA plus UMA for not accepting previews (Closed)
Patch Set: Added tests for NotAcceptingTransform histogram and fixed unittest hitting new NOTREACHED check Created 3 years, 6 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_config_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc
index 3d9e073a4e2d61d1788300b4c70ad29b74280cf7..58fd26b36ec1dd9c864d96145be1f19bbb7e272c 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc
@@ -1545,6 +1545,7 @@ TEST_F(DataReductionProxyConfigTest, ShouldAcceptServerPreview) {
scoped_feature_list.InitAndEnableFeature(
features::kDataReductionProxyDecidesTransform);
+ base::HistogramTester histogram_tester;
net::TestURLRequestContext context_;
net::TestDelegate delegate_;
std::unique_ptr<net::URLRequest> request = context_.CreateRequest(
@@ -1565,6 +1566,9 @@ TEST_F(DataReductionProxyConfigTest, ShouldAcceptServerPreview) {
switches::kDataReductionProxyLoFiValueDisabled);
EXPECT_FALSE(config()->ShouldAcceptServerPreview(*request.get(),
*previews_decider.get()));
+ histogram_tester.ExpectBucketCount(
+ "DataReductionProxy.Protocol.NotAcceptingTransform",
+ 0 /* NOT_ACCEPTING_TRANSFORM_DISABLED */, 1);
// Verify true for Slow Connection flag.
base::CommandLine::ForCurrentProcess()->InitFromArgv(0, NULL);
@@ -1583,6 +1587,9 @@ TEST_F(DataReductionProxyConfigTest, ShouldAcceptServerPreview) {
net::NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI);
EXPECT_FALSE(config()->ShouldAcceptServerPreview(*request.get(),
*previews_decider.get()));
+ histogram_tester.ExpectBucketCount(
+ "DataReductionProxy.Protocol.NotAcceptingTransform",
+ 2 /* NOT_ACCEPTING_TRANSFORM_DISABLED */, 1);
// Verify true for Cellular Only flag and 3G connection.
config()->SetConnectionTypeForTesting(
@@ -1601,6 +1608,9 @@ TEST_F(DataReductionProxyConfigTest, ShouldAcceptServerPreview) {
"DataReductionProxyPreviewsBlackListTransition", "Enabled");
EXPECT_FALSE(config()->ShouldAcceptServerPreview(*request.get(),
*previews_decider.get()));
+ histogram_tester.ExpectBucketCount(
+ "DataReductionProxy.Protocol.NotAcceptingTransform",
+ 1 /* NOT_ACCEPTING_TRANSFORM_BLACKLISTED */, 1);
previews_decider = base::MakeUnique<TestPreviewsDecider>(true);
EXPECT_TRUE(config()->ShouldAcceptServerPreview(*request.get(),
*previews_decider.get()));

Powered by Google App Engine
This is Rietveld 408576698