Commit 6f33ef17 authored by bartfab@chromium.org's avatar bartfab@chromium.org

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
parent 0dae6927
...@@ -972,27 +972,25 @@ TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestInstallDefaultHandler) { ...@@ -972,27 +972,25 @@ TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestInstallDefaultHandler) {
#define URL_p3u1 "http://p3u1.com/%s" #define URL_p3u1 "http://p3u1.com/%s"
TEST_F(ProtocolHandlerRegistryTest, TestPrefPolicyOverlapRegister) { TEST_F(ProtocolHandlerRegistryTest, TestPrefPolicyOverlapRegister) {
base::ListValue* handlers_registered_by_pref = new base::ListValue(); base::ListValue handlers_registered_by_pref;
base::ListValue* handlers_registered_by_policy = new base::ListValue(); base::ListValue handlers_registered_by_policy;
handlers_registered_by_pref->Append( handlers_registered_by_pref.Append(
GetProtocolHandlerValueWithDefault("p1", URL_p1u2, true)); GetProtocolHandlerValueWithDefault("p1", URL_p1u2, true));
handlers_registered_by_pref->Append( handlers_registered_by_pref.Append(
GetProtocolHandlerValueWithDefault("p1", URL_p1u1, true)); GetProtocolHandlerValueWithDefault("p1", URL_p1u1, true));
handlers_registered_by_pref->Append( handlers_registered_by_pref.Append(
GetProtocolHandlerValueWithDefault("p1", URL_p1u2, false)); GetProtocolHandlerValueWithDefault("p1", URL_p1u2, false));
handlers_registered_by_policy->Append( handlers_registered_by_policy.Append(
GetProtocolHandlerValueWithDefault("p1", URL_p1u1, false)); GetProtocolHandlerValueWithDefault("p1", URL_p1u1, false));
handlers_registered_by_policy->Append( handlers_registered_by_policy.Append(
GetProtocolHandlerValueWithDefault("p3", URL_p3u1, true)); GetProtocolHandlerValueWithDefault("p3", URL_p3u1, true));
profile()->GetPrefs()->Set( profile()->GetPrefs()->Set(prefs::kRegisteredProtocolHandlers,
prefs::kRegisteredProtocolHandlers, handlers_registered_by_pref);
*static_cast<base::Value*>(handlers_registered_by_pref)); profile()->GetPrefs()->Set(prefs::kPolicyRegisteredProtocolHandlers,
profile()->GetPrefs()->Set( handlers_registered_by_policy);
prefs::kPolicyRegisteredProtocolHandlers,
*static_cast<base::Value*>(handlers_registered_by_policy));
registry()->InitProtocolSettings(); registry()->InitProtocolSettings();
// Duplicate p1u2 eliminated in memory but not yet saved in pref // Duplicate p1u2 eliminated in memory but not yet saved in pref
...@@ -1054,24 +1052,22 @@ TEST_F(ProtocolHandlerRegistryTest, TestPrefPolicyOverlapRegister) { ...@@ -1054,24 +1052,22 @@ TEST_F(ProtocolHandlerRegistryTest, TestPrefPolicyOverlapRegister) {
} }
TEST_F(ProtocolHandlerRegistryTest, TestPrefPolicyOverlapIgnore) { TEST_F(ProtocolHandlerRegistryTest, TestPrefPolicyOverlapIgnore) {
base::ListValue* handlers_ignored_by_pref = new base::ListValue(); base::ListValue handlers_ignored_by_pref;
base::ListValue* handlers_ignored_by_policy = new base::ListValue(); base::ListValue handlers_ignored_by_policy;
handlers_ignored_by_pref->Append(GetProtocolHandlerValue("p1", URL_p1u1)); 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("p1", URL_p1u2)); handlers_ignored_by_pref.Append(GetProtocolHandlerValue("p1", URL_p1u2));
handlers_ignored_by_pref->Append(GetProtocolHandlerValue("p3", URL_p3u1)); 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_p1u2));
handlers_ignored_by_policy->Append(GetProtocolHandlerValue("p1", URL_p1u3)); handlers_ignored_by_policy.Append(GetProtocolHandlerValue("p1", URL_p1u3));
handlers_ignored_by_policy->Append(GetProtocolHandlerValue("p2", URL_p2u1)); handlers_ignored_by_policy.Append(GetProtocolHandlerValue("p2", URL_p2u1));
profile()->GetPrefs()->Set( profile()->GetPrefs()->Set(prefs::kIgnoredProtocolHandlers,
prefs::kIgnoredProtocolHandlers, handlers_ignored_by_pref);
*static_cast<base::Value*>(handlers_ignored_by_pref)); profile()->GetPrefs()->Set(prefs::kPolicyIgnoredProtocolHandlers,
profile()->GetPrefs()->Set( handlers_ignored_by_policy);
prefs::kPolicyIgnoredProtocolHandlers,
*static_cast<base::Value*>(handlers_ignored_by_policy));
registry()->InitProtocolSettings(); registry()->InitProtocolSettings();
// Duplicate p1u2 eliminated in memory but not yet saved in pref // Duplicate p1u2 eliminated in memory but not yet saved in pref
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment