Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1729)

Unified Diff: chrome/browser/notifications/sync_notifier/synced_notification_unittest.cc

Issue 14767029: Add API function chrome.notifications.getAll (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/notifications/sync_notifier/synced_notification_unittest.cc
diff --git a/chrome/browser/notifications/sync_notifier/synced_notification_unittest.cc b/chrome/browser/notifications/sync_notifier/synced_notification_unittest.cc
index 87810cce0928a9891f699ae57639b31deae620f2..6d7061dc2020828f2f54ba53ff30f5edd2ab73fe 100644
--- a/chrome/browser/notifications/sync_notifier/synced_notification_unittest.cc
+++ b/chrome/browser/notifications/sync_notifier/synced_notification_unittest.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/notifications/notification.h"
#include "chrome/browser/notifications/notification_ui_manager.h"
#include "chrome/browser/notifications/sync_notifier/synced_notification.h"
+#include "chrome/browser/profiles/profile.h"
#include "sync/api/sync_data.h"
#include "sync/protocol/sync.pb.h"
#include "sync/protocol/synced_notification_specifics.pb.h"
@@ -87,6 +88,7 @@ class StubNotificationUIManager : public NotificationUIManager {
OVERRIDE {
// Make a deep copy of the notification that we can inspect.
notification_ = notification;
+ profile_ = profile;
}
// Returns true if any notifications match the supplied ID, either currently
@@ -101,6 +103,16 @@ class StubNotificationUIManager : public NotificationUIManager {
return false;
}
+ virtual std::set<std::string> GetAllIdsByProfileAndSourceOrigin(
+ Profile* profile,
+ const GURL& source) OVERRIDE {
+ std::set<std::string> notification_ids;
+ if (source == notification_.origin_url() &&
+ profile->IsSameProfile(profile_))
+ notification_ids.insert(notification_.notification_id());
+ return notification_ids;
+ }
+
// Removes notifications matching the |source_origin| (which could be an
// extension ID). Returns true if anything was removed.
virtual bool CancelAllBySourceOrigin(const GURL& source_origin) OVERRIDE {
@@ -122,6 +134,7 @@ class StubNotificationUIManager : public NotificationUIManager {
private:
DISALLOW_COPY_AND_ASSIGN(StubNotificationUIManager);
Notification notification_;
+ Profile* profile_;
};
class SyncedNotificationTest : public testing::Test {

Powered by Google App Engine
This is Rietveld 408576698