summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/test/test_notification_tracker.cc8
-rw-r--r--chrome/test/test_notification_tracker.h5
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_;