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

Unified Diff: chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_unittest.cc

Issue 1104413003: Check for *.googlezip.net proxies when migrating proxy pref for DRP. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test for http://googlezip.net Created 5 years, 8 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
« no previous file with comments | « chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_unittest.cc
diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_unittest.cc b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_unittest.cc
index c9de4084b69156078e759fa7b7604520d3da12b7..e13020f69accd0b5e2d20b2e1949ed3839960d4d 100644
--- a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_unittest.cc
+++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_unittest.cc
@@ -75,35 +75,78 @@ TEST_F(DataReductionProxyChromeSettingsTest, MigrateSystemProxy) {
}
TEST_F(DataReductionProxyChromeSettingsTest, MigrateDataReductionProxy) {
- dict_->SetString("mode", "fixed_servers");
- dict_->SetString("server", "http=https://proxy.googlezip.net");
- test_context_->pref_service()->Set(prefs::kProxy, *dict_.get());
- EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(1)
- .WillOnce(Return(true));
-
- drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs(
- test_context_->pref_service());
+ const std::string kTestServers[] = {"http=http://proxy.googlezip.net",
+ "http=https://my-drp.org",
+ "https=https://tunneldrp.com"};
+
+ for (const std::string& test_server : kTestServers) {
+ dict_.reset(new base::DictionaryValue());
+ dict_->SetString("mode", "fixed_servers");
+ dict_->SetString("server", test_server);
+ test_context_->pref_service()->Set(prefs::kProxy, *dict_.get());
+ EXPECT_CALL(*config_, ContainsDataReductionProxy(_))
+ .Times(1)
+ .WillOnce(Return(true));
+
+ drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs(
+ test_context_->pref_service());
+
+ EXPECT_EQ(NULL, test_context_->pref_service()->GetUserPref(prefs::kProxy));
+ }
+}
- EXPECT_EQ(NULL, test_context_->pref_service()->GetUserPref(prefs::kProxy));
+TEST_F(DataReductionProxyChromeSettingsTest,
+ MigrateGooglezipDataReductionProxy) {
+ const std::string kTestServers[] = {
+ "http=http://proxy-dev.googlezip.net",
+ "http=https://arbitraryprefix.googlezip.net",
+ "https=https://tunnel.googlezip.net"};
+
+ for (const std::string& test_server : kTestServers) {
+ dict_.reset(new base::DictionaryValue());
+ // The proxy pref is set to a Data Reduction Proxy that doesn't match the
+ // currently configured DRP, but the pref should still be cleared.
+ dict_->SetString("mode", "fixed_servers");
+ dict_->SetString("server", test_server);
+ test_context_->pref_service()->Set(prefs::kProxy, *dict_.get());
+ EXPECT_CALL(*config_, ContainsDataReductionProxy(_))
+ .Times(1)
+ .WillOnce(Return(false));
+
+ drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs(
+ test_context_->pref_service());
+
+ EXPECT_EQ(NULL, test_context_->pref_service()->GetUserPref(prefs::kProxy));
+ }
}
TEST_F(DataReductionProxyChromeSettingsTest, MigrateIgnoreOtherProxy) {
- dict_->SetString("mode", "fixed_servers");
- dict_->SetString("server", "http=https://youtube.com");
- test_context_->pref_service()->Set(prefs::kProxy, *dict_.get());
- EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(1)
- .WillOnce(Return(false));
-
- drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs(
- test_context_->pref_service());
-
- base::DictionaryValue* value =
- (base::DictionaryValue*)test_context_->pref_service()->GetUserPref(
- prefs::kProxy);
- std::string mode;
- EXPECT_TRUE(value->GetString("mode", &mode));
- EXPECT_EQ("fixed_servers", mode);
- std::string server;
- EXPECT_TRUE(value->GetString("server", &server));
- EXPECT_EQ("http=https://youtube.com", server);
+ const std::string kTestServers[] = {
+ "http=https://youtube.com",
+ "http=http://googlezip.net",
+ "http=http://thisismyproxynotgooglezip.net",
+ "https=http://arbitraryprefixgooglezip.net"};
+
+ for (const std::string& test_server : kTestServers) {
+ dict_.reset(new base::DictionaryValue());
+ dict_->SetString("mode", "fixed_servers");
+ dict_->SetString("server", test_server);
+ test_context_->pref_service()->Set(prefs::kProxy, *dict_.get());
+ EXPECT_CALL(*config_, ContainsDataReductionProxy(_))
+ .Times(1)
+ .WillOnce(Return(false));
+
+ drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs(
+ test_context_->pref_service());
+
+ base::DictionaryValue* value =
+ (base::DictionaryValue*)test_context_->pref_service()->GetUserPref(
+ prefs::kProxy);
+ std::string mode;
+ EXPECT_TRUE(value->GetString("mode", &mode));
+ EXPECT_EQ("fixed_servers", mode);
+ std::string server;
+ EXPECT_TRUE(value->GetString("server", &server));
+ EXPECT_EQ(test_server, server);
+ }
}
« no previous file with comments | « chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698