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

Unified Diff: chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc

Issue 310483008: Followup to commit 274223 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Issue_116119_pre
Patch Set: Moves a variable from heap to stack for avoiding memory leak Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
index 89bd5f5d9623fe2c0f4acb913fd6bfdbb0f1702e..b87384d5e88ea574f69258a0ab683c8d8de4c990 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
@@ -972,27 +972,25 @@ TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestInstallDefaultHandler) {
#define URL_p3u1 "http://p3u1.com/%s"
TEST_F(ProtocolHandlerRegistryTest, TestPrefPolicyOverlapRegister) {
- base::ListValue* handlers_registered_by_pref = new base::ListValue();
- base::ListValue* handlers_registered_by_policy = new base::ListValue();
+ base::ListValue handlers_registered_by_pref;
+ base::ListValue handlers_registered_by_policy;
- handlers_registered_by_pref->Append(
+ handlers_registered_by_pref.Append(
GetProtocolHandlerValueWithDefault("p1", URL_p1u2, true));
- handlers_registered_by_pref->Append(
+ handlers_registered_by_pref.Append(
GetProtocolHandlerValueWithDefault("p1", URL_p1u1, true));
- handlers_registered_by_pref->Append(
+ handlers_registered_by_pref.Append(
GetProtocolHandlerValueWithDefault("p1", URL_p1u2, false));
- handlers_registered_by_policy->Append(
+ handlers_registered_by_policy.Append(
GetProtocolHandlerValueWithDefault("p1", URL_p1u1, false));
- handlers_registered_by_policy->Append(
+ handlers_registered_by_policy.Append(
GetProtocolHandlerValueWithDefault("p3", URL_p3u1, true));
- profile()->GetPrefs()->Set(
- prefs::kRegisteredProtocolHandlers,
- *static_cast<base::Value*>(handlers_registered_by_pref));
- profile()->GetPrefs()->Set(
- prefs::kPolicyRegisteredProtocolHandlers,
- *static_cast<base::Value*>(handlers_registered_by_policy));
+ profile()->GetPrefs()->Set(prefs::kRegisteredProtocolHandlers,
+ handlers_registered_by_pref);
+ profile()->GetPrefs()->Set(prefs::kPolicyRegisteredProtocolHandlers,
+ handlers_registered_by_policy);
registry()->InitProtocolSettings();
// Duplicate p1u2 eliminated in memory but not yet saved in pref
@@ -1054,24 +1052,22 @@ TEST_F(ProtocolHandlerRegistryTest, TestPrefPolicyOverlapRegister) {
}
TEST_F(ProtocolHandlerRegistryTest, TestPrefPolicyOverlapIgnore) {
- base::ListValue* handlers_ignored_by_pref = new base::ListValue();
- base::ListValue* handlers_ignored_by_policy = new base::ListValue();
-
- handlers_ignored_by_pref->Append(GetProtocolHandlerValue("p1", URL_p1u1));
- handlers_ignored_by_pref->Append(GetProtocolHandlerValue("p1", URL_p1u2));
- handlers_ignored_by_pref->Append(GetProtocolHandlerValue("p1", URL_p1u2));
- handlers_ignored_by_pref->Append(GetProtocolHandlerValue("p3", URL_p3u1));
-
- handlers_ignored_by_policy->Append(GetProtocolHandlerValue("p1", URL_p1u2));
- handlers_ignored_by_policy->Append(GetProtocolHandlerValue("p1", URL_p1u3));
- handlers_ignored_by_policy->Append(GetProtocolHandlerValue("p2", URL_p2u1));
-
- profile()->GetPrefs()->Set(
- prefs::kIgnoredProtocolHandlers,
- *static_cast<base::Value*>(handlers_ignored_by_pref));
- profile()->GetPrefs()->Set(
- prefs::kPolicyIgnoredProtocolHandlers,
- *static_cast<base::Value*>(handlers_ignored_by_policy));
+ base::ListValue handlers_ignored_by_pref;
+ base::ListValue handlers_ignored_by_policy;
+
+ handlers_ignored_by_pref.Append(GetProtocolHandlerValue("p1", URL_p1u1));
+ handlers_ignored_by_pref.Append(GetProtocolHandlerValue("p1", URL_p1u2));
+ handlers_ignored_by_pref.Append(GetProtocolHandlerValue("p1", URL_p1u2));
+ handlers_ignored_by_pref.Append(GetProtocolHandlerValue("p3", URL_p3u1));
+
+ handlers_ignored_by_policy.Append(GetProtocolHandlerValue("p1", URL_p1u2));
+ handlers_ignored_by_policy.Append(GetProtocolHandlerValue("p1", URL_p1u3));
+ handlers_ignored_by_policy.Append(GetProtocolHandlerValue("p2", URL_p2u1));
+
+ profile()->GetPrefs()->Set(prefs::kIgnoredProtocolHandlers,
+ handlers_ignored_by_pref);
+ profile()->GetPrefs()->Set(prefs::kPolicyIgnoredProtocolHandlers,
+ handlers_ignored_by_policy);
registry()->InitProtocolSettings();
// Duplicate p1u2 eliminated in memory but not yet saved in pref
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698