summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlaforge@chromium.org <laforge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-07 19:10:20 +0000
committerlaforge@chromium.org <laforge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-07 19:10:20 +0000
commit289f8b792d7194c11df85f1fa30a1a63bf872eee (patch)
tree852cadf3775d5bde1e20065a404a477bab432c40
parentba541c0f456dfb8aec9c393f6a54933389cfe522 (diff)
downloadchromium_src-289f8b792d7194c11df85f1fa30a1a63bf872eee.zip
chromium_src-289f8b792d7194c11df85f1fa30a1a63bf872eee.tar.gz
chromium_src-289f8b792d7194c11df85f1fa30a1a63bf872eee.tar.bz2
Merge 88109 - Cause enabled state in ProtocolHandlerRegistry to persist.
TEST=Test cases provided. Review URL: http://codereview.chromium.org/7056065 TBR=koz@chromium.org Review URL: http://codereview.chromium.org/7108008 git-svn-id: svn://svn.chromium.org/chrome/branches/782/src@88168 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/custom_handlers/protocol_handler_registry.cc2
-rw-r--r--chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc8
2 files changed, 9 insertions, 1 deletions
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc
index 1ea0465..4f2c2b8 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc
@@ -106,6 +106,7 @@ void ProtocolHandlerRegistry::Enable() {
for (p = default_handlers_.begin(); p != default_handlers_.end(); ++p) {
delegate_->RegisterExternalHandler(p->first);
}
+ Save();
}
NotifyChanged();
}
@@ -121,6 +122,7 @@ void ProtocolHandlerRegistry::Disable() {
for (p = default_handlers_.begin(); p != default_handlers_.end(); ++p) {
delegate_->DeregisterExternalHandler(p->first);
}
+ Save();
}
NotifyChanged();
}
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
index a35b75f..a5fc7de 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
@@ -139,6 +139,7 @@ class ProtocolHandlerRegistryTest : public RenderViewHostTestHarness {
void ReloadProtocolHandlerRegistry() {
delegate_ = new FakeDelegate();
+ registry_->Finalize();
registry_ = new ProtocolHandlerRegistry(profile(), delegate());
registry_->Load();
}
@@ -296,11 +297,16 @@ TEST_F(ProtocolHandlerRegistryTest, TestDefaultSaveLoad) {
registry()->OnDenyRegisterProtocolHandler(ph2);
registry()->OnAcceptRegisterProtocolHandler(ph2);
+ registry()->Disable();
ReloadProtocolHandlerRegistry();
-
+ ASSERT_FALSE(registry()->enabled());
+ registry()->Enable();
ASSERT_FALSE(registry()->IsDefault(ph1));
ASSERT_TRUE(registry()->IsDefault(ph2));
+
+ ReloadProtocolHandlerRegistry();
+ ASSERT_TRUE(registry()->enabled());
}
TEST_F(ProtocolHandlerRegistryTest, TestRemoveHandler) {