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

Unified Diff: chrome/browser/prefs/proxy_policy_unittest.cc

Issue 2785883003: Use unique_ptr<DictionaryValue> in ProxyConfigDictionary (Closed)
Patch Set: Fix compilation Created 3 years, 9 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/prefs/proxy_policy_unittest.cc
diff --git a/chrome/browser/prefs/proxy_policy_unittest.cc b/chrome/browser/prefs/proxy_policy_unittest.cc
index 8fdcaab97cd7c7a7a39027e8d56a7733a0980c68..3d1880211bfdaa5bcbf80000a450543d86ba3d29 100644
--- a/chrome/browser/prefs/proxy_policy_unittest.cc
+++ b/chrome/browser/prefs/proxy_policy_unittest.cc
@@ -144,7 +144,8 @@ TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) {
// First verify that command-line options are set correctly when
// there is no policy in effect.
std::unique_ptr<PrefService> prefs(CreatePrefService(false));
- ProxyConfigDictionary dict(prefs->GetDictionary(proxy_config::prefs::kProxy));
+ ProxyConfigDictionary dict(
+ prefs->GetDictionary(proxy_config::prefs::kProxy)->CreateDeepCopy());
assertProxyMode(dict, ProxyPrefs::MODE_FIXED_SERVERS);
assertProxyServer(dict, "789");
assertPacUrl(dict, std::string());
@@ -155,7 +156,7 @@ TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) {
// line and replaced them with the policy versions.
prefs = CreatePrefService(true);
ProxyConfigDictionary dict2(
- prefs->GetDictionary(proxy_config::prefs::kProxy));
+ prefs->GetDictionary(proxy_config::prefs::kProxy)->CreateDeepCopy());
assertProxyMode(dict2, ProxyPrefs::MODE_FIXED_SERVERS);
assertProxyServer(dict2, "ghi");
assertPacUrl(dict2, std::string());
@@ -175,7 +176,8 @@ TEST_F(ProxyPolicyTest, OverridesUnrelatedCommandLineOptions) {
// First verify that command-line options are set correctly when
// there is no policy in effect.
std::unique_ptr<PrefService> prefs = CreatePrefService(false);
- ProxyConfigDictionary dict(prefs->GetDictionary(proxy_config::prefs::kProxy));
+ ProxyConfigDictionary dict(
+ prefs->GetDictionary(proxy_config::prefs::kProxy)->CreateDeepCopy());
assertProxyMode(dict, ProxyPrefs::MODE_FIXED_SERVERS);
assertProxyServer(dict, "789");
assertPacUrl(dict, std::string());
@@ -187,7 +189,7 @@ TEST_F(ProxyPolicyTest, OverridesUnrelatedCommandLineOptions) {
// set in policy.
prefs = CreatePrefService(true);
ProxyConfigDictionary dict2(
- prefs->GetDictionary(proxy_config::prefs::kProxy));
+ prefs->GetDictionary(proxy_config::prefs::kProxy)->CreateDeepCopy());
assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_AUTO_DETECT);
}
@@ -203,7 +205,8 @@ TEST_F(ProxyPolicyTest, OverridesCommandLineNoProxy) {
// First verify that command-line options are set correctly when
// there is no policy in effect.
std::unique_ptr<PrefService> prefs = CreatePrefService(false);
- ProxyConfigDictionary dict(prefs->GetDictionary(proxy_config::prefs::kProxy));
+ ProxyConfigDictionary dict(
+ prefs->GetDictionary(proxy_config::prefs::kProxy)->CreateDeepCopy());
assertProxyModeWithoutParams(dict, ProxyPrefs::MODE_DIRECT);
// Try a second time time with the managed PrefStore in place, the
@@ -211,7 +214,7 @@ TEST_F(ProxyPolicyTest, OverridesCommandLineNoProxy) {
// in place with the appropriate default value for this to work.
prefs = CreatePrefService(true);
ProxyConfigDictionary dict2(
- prefs->GetDictionary(proxy_config::prefs::kProxy));
+ prefs->GetDictionary(proxy_config::prefs::kProxy)->CreateDeepCopy());
assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_AUTO_DETECT);
}
@@ -227,7 +230,8 @@ TEST_F(ProxyPolicyTest, OverridesCommandLineAutoDetect) {
// First verify that the auto-detect is set if there is no managed
// PrefStore.
std::unique_ptr<PrefService> prefs = CreatePrefService(false);
- ProxyConfigDictionary dict(prefs->GetDictionary(proxy_config::prefs::kProxy));
+ ProxyConfigDictionary dict(
+ prefs->GetDictionary(proxy_config::prefs::kProxy)->CreateDeepCopy());
assertProxyModeWithoutParams(dict, ProxyPrefs::MODE_AUTO_DETECT);
// Try a second time time with the managed PrefStore in place, the
@@ -235,7 +239,7 @@ TEST_F(ProxyPolicyTest, OverridesCommandLineAutoDetect) {
// in place with the appropriate default value for this to work.
prefs = CreatePrefService(true);
ProxyConfigDictionary dict2(
- prefs->GetDictionary(proxy_config::prefs::kProxy));
+ prefs->GetDictionary(proxy_config::prefs::kProxy)->CreateDeepCopy());
assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_DIRECT);
}

Powered by Google App Engine
This is Rietveld 408576698