diff options
author | bartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-02 16:09:43 +0000 |
---|---|---|
committer | bartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-02 16:09:43 +0000 |
commit | 6f33ef170b7a2ad591727e9633257fb8d5f9f872 (patch) | |
tree | 8efe0208856a8f7f393b625d327c35d058a6d72b | |
parent | 0dae69276ba560251e1f4c079ffd0a6130b57b06 (diff) | |
download | chromium_src-6f33ef170b7a2ad591727e9633257fb8d5f9f872.zip chromium_src-6f33ef170b7a2ad591727e9633257fb8d5f9f872.tar.gz chromium_src-6f33ef170b7a2ad591727e9633257fb8d5f9f872.tar.bz2 |
Followup to commit 274223
Fixes the memory leak in the unit tests
BUG=116119
TBR=koz,jochen
Review URL: https://codereview.chromium.org/310483008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274256 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc index 89bd5f5..b87384d 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 |