diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-21 21:27:24 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-21 21:27:24 +0000 |
commit | bf3ec7355013aa824eca19a0362638771defd4e7 (patch) | |
tree | ad5efeeac31f5a9c2a7d7419fe50bca6b727f067 | |
parent | 8ebd02bc2e0b778418c06060d990fc6ceda21b5a (diff) | |
download | chromium_src-bf3ec7355013aa824eca19a0362638771defd4e7.zip chromium_src-bf3ec7355013aa824eca19a0362638771defd4e7.tar.gz chromium_src-bf3ec7355013aa824eca19a0362638771defd4e7.tar.bz2 |
Use a NotificationRegistrar to listen for notifications.
BUG=2381
Review URL: http://codereview.chromium.org/113719
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16661 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/test/test_notification_tracker.cc | 8 | ||||
-rw-r--r-- | chrome/test/test_notification_tracker.h | 5 |
2 files changed, 3 insertions, 10 deletions
diff --git a/chrome/test/test_notification_tracker.cc b/chrome/test/test_notification_tracker.cc index dd22b3b..d346911 100644 --- a/chrome/test/test_notification_tracker.cc +++ b/chrome/test/test_notification_tracker.cc @@ -3,7 +3,6 @@ // found in the LICENSE file. #include "chrome/test/test_notification_tracker.h" -#include "chrome/common/notification_service.h" TestNotificationTracker::Event::Event() : type(NotificationType::ALL), @@ -22,16 +21,11 @@ TestNotificationTracker::TestNotificationTracker() { } TestNotificationTracker::~TestNotificationTracker() { - NotificationService* service = NotificationService::current(); - for (size_t i = 0; i < listening_.size(); i++) - service->RemoveObserver(this, listening_[i].first, listening_[i].second); - listening_.clear(); } void TestNotificationTracker::ListenFor(NotificationType type, const NotificationSource& source) { - listening_.push_back(std::make_pair(type, source)); - NotificationService::current()->AddObserver(this, type, source); + registrar_.Add(this, type, source); } void TestNotificationTracker::Reset() { diff --git a/chrome/test/test_notification_tracker.h b/chrome/test/test_notification_tracker.h index 23d351c..fbc2392 100644 --- a/chrome/test/test_notification_tracker.h +++ b/chrome/test/test_notification_tracker.h @@ -7,6 +7,7 @@ #include <vector> +#include "chrome/common/notification_registrar.h" #include "chrome/common/notification_service.h" // Provides an easy way for tests to verify that a given set of notifications @@ -67,9 +68,7 @@ class TestNotificationTracker : public NotificationObserver { const NotificationSource& source, const NotificationDetails& details); - // Lists all type/source combinations that we're listening for. These will - // need to be unregistered when we are destroyed. - std::vector< std::pair<NotificationType, NotificationSource> > listening_; + NotificationRegistrar registrar_; // Lists all received since last cleared, in the order they were received. std::vector<Event> events_; |