diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-02 22:12:45 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-02 22:12:45 +0000 |
commit | b5c8ff9cf03f15980a86fba0e06fd34682876234 (patch) | |
tree | 18a4a5ced2029fc789a6550cd59f42776bd0ee45 /chrome/browser/custom_handlers | |
parent | fab6d2a21f10417ba5a9ba73969e32df82c29253 (diff) | |
download | chromium_src-b5c8ff9cf03f15980a86fba0e06fd34682876234.zip chromium_src-b5c8ff9cf03f15980a86fba0e06fd34682876234.tar.gz chromium_src-b5c8ff9cf03f15980a86fba0e06fd34682876234.tar.bz2 |
Profiles: Fix AllSources usage with NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED.
BUG=87457
TEST=none
Review URL: http://codereview.chromium.org/7518040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95169 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/custom_handlers')
-rw-r--r-- | chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc index 38f938e..c8b8170 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc @@ -142,18 +142,12 @@ ShellIntegration::DefaultProtocolClientWorker* FakeDelegate::CreateShellWorker( class NotificationCounter : public NotificationObserver { public: - NotificationCounter() + explicit NotificationCounter(Profile* profile) : events_(0), notification_registrar_() { notification_registrar_.Add(this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, - NotificationService::AllSources()); - } - - ~NotificationCounter() { - notification_registrar_.Remove(this, - chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, - NotificationService::AllSources()); + Source<Profile>(profile)); } int events() { return events_; } @@ -171,13 +165,14 @@ class NotificationCounter : public NotificationObserver { class QueryProtocolHandlerOnChange : public NotificationObserver { public: - explicit QueryProtocolHandlerOnChange(ProtocolHandlerRegistry* registry) + QueryProtocolHandlerOnChange(Profile* profile, + ProtocolHandlerRegistry* registry) : registry_(registry), called_(false), notification_registrar_() { notification_registrar_.Add(this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, - NotificationService::AllSources()); + Source<Profile>(profile)); } virtual void Observe(int type, @@ -490,7 +485,7 @@ TEST_F(ProtocolHandlerRegistryTest, TestIsHandledProtocol) { TEST_F(ProtocolHandlerRegistryTest, TestNotifications) { ProtocolHandler ph1 = CreateProtocolHandler("test", "test1"); - NotificationCounter counter; + NotificationCounter counter(profile()); registry()->OnAcceptRegisterProtocolHandler(ph1); ASSERT_TRUE(counter.notified()); @@ -510,7 +505,7 @@ TEST_F(ProtocolHandlerRegistryTest, TestNotifications) { } TEST_F(ProtocolHandlerRegistryTest, TestReentrantNotifications) { - QueryProtocolHandlerOnChange queryer(registry()); + QueryProtocolHandlerOnChange queryer(profile(), registry()); ProtocolHandler ph1 = CreateProtocolHandler("test", "test1"); registry()->OnAcceptRegisterProtocolHandler(ph1); ASSERT_TRUE(queryer.called_); |