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

Unified Diff: chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc

Issue 1145513004: Record UMA when googlezip proxies are removed from the proxy config. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment about bitwise ORs Created 5 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: chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc
diff --git a/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc b/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc
index 44a3c005b5b9fe396259c820d9726ac9c38d74b4..afbdf9489e8a6781fb389de4b69fbda3973e46aa 100644
--- a/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc
+++ b/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc
@@ -11,6 +11,7 @@
#include "base/message_loop/message_loop.h"
#include "base/prefs/pref_registry_simple.h"
#include "base/prefs/testing_pref_service.h"
+#include "base/test/histogram_tester.h"
#include "chrome/browser/prefs/pref_service_mock_factory.h"
#include "chrome/browser/prefs/proxy_config_dictionary.h"
#include "chrome/common/chrome_switches.h"
@@ -316,33 +317,55 @@ TEST_F(PrefProxyConfigTrackerImplTest, ExcludeGooglezipDataReductionProxies) {
const char* http_proxy_info;
const char* https_proxy_info;
const char* ftp_proxy_info;
+ PrefProxyConfigTrackerImpl::GooglezipProxyRemovalResult expected_result;
} test_cases[] = {
{"http=foopyhttp," + kDataReductionProxies +
",direct://;https=foopyhttps," + kDataReductionProxies +
",direct://;ftp=foopyftp," + kDataReductionProxies + ",direct://",
"foopyhttp;direct://",
"foopyhttps;direct://",
- "foopyftp;direct://"},
+ "foopyftp;direct://",
+ PrefProxyConfigTrackerImpl::
+ GOOGLEZIP_PROXY_REMOVAL_RESULT_FOUND_AND_REMOVED},
{"foopy," + kDataReductionProxies + ",direct://",
"foopy;direct://",
"foopy;direct://",
- "foopy;direct://"},
+ "foopy;direct://",
+ PrefProxyConfigTrackerImpl::
+ GOOGLEZIP_PROXY_REMOVAL_RESULT_FOUND_AND_REMOVED},
{"http=" + kDataReductionProxies + ";https=" + kDataReductionProxies +
";ftp=" + kDataReductionProxies,
"direct://",
"direct://",
- "direct://"},
+ "direct://",
+ PrefProxyConfigTrackerImpl::
+ GOOGLEZIP_PROXY_REMOVAL_RESULT_FOUND_AND_REMOVED},
{"http=" + kDataReductionProxies + ",foopy,direct://",
"foopy;direct://",
"direct://",
- "direct://"},
+ "direct://",
+ PrefProxyConfigTrackerImpl::
+ GOOGLEZIP_PROXY_REMOVAL_RESULT_FOUND_AND_REMOVED},
+
+ {"foopy,direct://",
+ "foopy;direct://",
+ "foopy;direct://",
+ "foopy;direct://",
+ PrefProxyConfigTrackerImpl::GOOGLEZIP_PROXY_REMOVAL_RESULT_NOT_FOUND},
+
+ {"direct://",
+ "direct://",
+ "direct://",
+ "direct://",
+ PrefProxyConfigTrackerImpl::GOOGLEZIP_PROXY_REMOVAL_RESULT_NOT_FOUND},
};
// Test setting the proxy from a user pref.
for (const auto& test : test_cases) {
+ base::HistogramTester histogram_tester;
pref_service_->SetUserPref(prefs::kProxy,
ProxyConfigDictionary::CreateFixedServers(
test.initial_proxy_rules, std::string()));
@@ -351,6 +374,9 @@ TEST_F(PrefProxyConfigTrackerImplTest, ExcludeGooglezipDataReductionProxies) {
net::ProxyConfig config;
EXPECT_EQ(net::ProxyConfigService::CONFIG_VALID,
proxy_config_service_->GetLatestProxyConfig(&config));
+ histogram_tester.ExpectUniqueSample(
eroman 2015/05/14 22:20:15 neat, thanks for adding the test!
sclittle 2015/05/15 02:29:42 Acknowledged.
+ "Net.PrefProxyConfig.GooglezipProxyRemovalResult", test.expected_result,
+ 1);
CheckResolvedProxyMatches(&config, GURL("http://google.com"),
test.http_proxy_info);

Powered by Google App Engine
This is Rietveld 408576698