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

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

Issue 1296663003: Componentize proxy code from chrome/browser/net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/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 7bba517d380505bcc9b49de091f82185df379de9..9ae6f14f38c67f9933c8d5de8a98b66dd1648b94 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
@@ -14,6 +14,7 @@
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h"
+#include "components/proxy_config/proxy_prefs.h"
#include "testing/gtest/include/gtest/gtest.h"
using testing::_;
@@ -34,7 +35,7 @@ class DataReductionProxyChromeSettingsTest : public testing::Test {
dict_ = make_scoped_ptr(new base::DictionaryValue());
PrefRegistrySimple* registry = test_context_->pref_service()->registry();
- registry->RegisterDictionaryPref(prefs::kProxy);
+ registry->RegisterDictionaryPref(ProxyPrefs::kProxy);
}
base::MessageLoopForIO message_loop_;
@@ -50,7 +51,8 @@ TEST_F(DataReductionProxyChromeSettingsTest, MigrateNonexistentProxyPref) {
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(ProxyPrefs::kProxy));
histogram_tester.ExpectUniqueSample(
"DataReductionProxy.ProxyPrefMigrationResult",
DataReductionProxyChromeSettings::PROXY_PREF_NOT_CLEARED, 1);
@@ -79,7 +81,7 @@ TEST_F(DataReductionProxyChromeSettingsTest, MigrateBadlyFormedProxyPref) {
dict_->SetString("mode", test.proxy_mode_string);
if (test.proxy_server_string)
dict_->SetString("server", test.proxy_server_string);
- test_context_->pref_service()->Set(prefs::kProxy, *dict_.get());
+ test_context_->pref_service()->Set(ProxyPrefs::kProxy, *dict_.get());
EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(0);
drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs(
@@ -87,7 +89,7 @@ TEST_F(DataReductionProxyChromeSettingsTest, MigrateBadlyFormedProxyPref) {
const base::DictionaryValue* final_value;
test_context_->pref_service()
- ->GetUserPref(prefs::kProxy)
+ ->GetUserPref(ProxyPrefs::kProxy)
->GetAsDictionary(&final_value);
EXPECT_NE(nullptr, final_value);
EXPECT_TRUE(dict_->Equals(final_value));
@@ -100,12 +102,13 @@ TEST_F(DataReductionProxyChromeSettingsTest, MigrateBadlyFormedProxyPref) {
TEST_F(DataReductionProxyChromeSettingsTest, MigrateEmptyProxy) {
base::HistogramTester histogram_tester;
- test_context_->pref_service()->Set(prefs::kProxy, *dict_.get());
+ test_context_->pref_service()->Set(ProxyPrefs::kProxy, *dict_.get());
EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(0);
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(ProxyPrefs::kProxy));
histogram_tester.ExpectUniqueSample(
"DataReductionProxy.ProxyPrefMigrationResult",
DataReductionProxyChromeSettings::PROXY_PREF_CLEARED_EMPTY, 1);
@@ -114,13 +117,14 @@ TEST_F(DataReductionProxyChromeSettingsTest, MigrateEmptyProxy) {
TEST_F(DataReductionProxyChromeSettingsTest, MigrateSystemProxy) {
base::HistogramTester histogram_tester;
dict_->SetString("mode", "system");
- test_context_->pref_service()->Set(prefs::kProxy, *dict_.get());
+ test_context_->pref_service()->Set(ProxyPrefs::kProxy, *dict_.get());
EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(0);
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(ProxyPrefs::kProxy));
histogram_tester.ExpectUniqueSample(
"DataReductionProxy.ProxyPrefMigrationResult",
DataReductionProxyChromeSettings::PROXY_PREF_CLEARED_MODE_SYSTEM, 1);
@@ -136,7 +140,7 @@ TEST_F(DataReductionProxyChromeSettingsTest, MigrateDataReductionProxy) {
dict_.reset(new base::DictionaryValue());
dict_->SetString("mode", "fixed_servers");
dict_->SetString("server", test_server);
- test_context_->pref_service()->Set(prefs::kProxy, *dict_.get());
+ test_context_->pref_service()->Set(ProxyPrefs::kProxy, *dict_.get());
EXPECT_CALL(*config_, ContainsDataReductionProxy(_))
.Times(1)
.WillOnce(Return(true));
@@ -144,7 +148,8 @@ TEST_F(DataReductionProxyChromeSettingsTest, MigrateDataReductionProxy) {
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(ProxyPrefs::kProxy));
histogram_tester.ExpectUniqueSample(
"DataReductionProxy.ProxyPrefMigrationResult",
DataReductionProxyChromeSettings::PROXY_PREF_CLEARED_DRP, 1);
@@ -165,7 +170,7 @@ TEST_F(DataReductionProxyChromeSettingsTest,
// 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());
+ test_context_->pref_service()->Set(ProxyPrefs::kProxy, *dict_.get());
EXPECT_CALL(*config_, ContainsDataReductionProxy(_))
.Times(1)
.WillOnce(Return(false));
@@ -173,7 +178,8 @@ TEST_F(DataReductionProxyChromeSettingsTest,
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(ProxyPrefs::kProxy));
histogram_tester.ExpectUniqueSample(
"DataReductionProxy.ProxyPrefMigrationResult",
DataReductionProxyChromeSettings::PROXY_PREF_CLEARED_GOOGLEZIP, 1);
@@ -257,7 +263,7 @@ TEST_F(DataReductionProxyChromeSettingsTest,
dict_.reset(new base::DictionaryValue());
dict_->SetString("mode", "pac_script");
dict_->SetString("pac_url", test.pac_url);
- test_context_->pref_service()->Set(prefs::kProxy, *dict_.get());
+ test_context_->pref_service()->Set(ProxyPrefs::kProxy, *dict_.get());
EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(0);
drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs(
@@ -265,7 +271,7 @@ TEST_F(DataReductionProxyChromeSettingsTest,
if (test.expect_pref_cleared) {
EXPECT_EQ(NULL,
- test_context_->pref_service()->GetUserPref(prefs::kProxy));
+ test_context_->pref_service()->GetUserPref(ProxyPrefs::kProxy));
histogram_tester.ExpectUniqueSample(
"DataReductionProxy.ProxyPrefMigrationResult",
DataReductionProxyChromeSettings::PROXY_PREF_CLEARED_PAC_GOOGLEZIP,
@@ -273,7 +279,7 @@ TEST_F(DataReductionProxyChromeSettingsTest,
} else {
const base::DictionaryValue* value;
EXPECT_TRUE(test_context_->pref_service()
- ->GetUserPref(prefs::kProxy)
+ ->GetUserPref(ProxyPrefs::kProxy)
->GetAsDictionary(&value));
std::string mode;
EXPECT_TRUE(value->GetString("mode", &mode));
@@ -301,7 +307,7 @@ TEST_F(DataReductionProxyChromeSettingsTest, MigrateIgnoreOtherProxy) {
dict_.reset(new base::DictionaryValue());
dict_->SetString("mode", "fixed_servers");
dict_->SetString("server", test_server);
- test_context_->pref_service()->Set(prefs::kProxy, *dict_.get());
+ test_context_->pref_service()->Set(ProxyPrefs::kProxy, *dict_.get());
EXPECT_CALL(*config_, ContainsDataReductionProxy(_))
.Times(1)
.WillOnce(Return(false));
@@ -311,7 +317,7 @@ TEST_F(DataReductionProxyChromeSettingsTest, MigrateIgnoreOtherProxy) {
base::DictionaryValue* value =
(base::DictionaryValue*)test_context_->pref_service()->GetUserPref(
- prefs::kProxy);
+ ProxyPrefs::kProxy);
std::string mode;
EXPECT_TRUE(value->GetString("mode", &mode));
EXPECT_EQ("fixed_servers", mode);

Powered by Google App Engine
This is Rietveld 408576698