Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / notifications / notification_test_util.h
blobe2d34ebb0c10a5f90b4b917117b92afd925136e9
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_
8 #include <set>
9 #include <string>
10 #include <utility>
11 #include <vector>
13 #include "base/callback.h"
14 #include "chrome/browser/notifications/notification.h"
15 #include "chrome/browser/notifications/notification_ui_manager.h"
17 class Profile;
19 // NotificationDelegate which does nothing, useful for testing when
20 // the notification events are not important.
21 class MockNotificationDelegate : public NotificationDelegate {
22 public:
23 explicit MockNotificationDelegate(const std::string& id);
25 // NotificationDelegate interface.
26 std::string id() const override;
28 private:
29 ~MockNotificationDelegate() override;
31 std::string id_;
33 DISALLOW_COPY_AND_ASSIGN(MockNotificationDelegate);
36 class StubNotificationUIManager : public NotificationUIManager {
37 public:
38 StubNotificationUIManager();
39 ~StubNotificationUIManager() override;
41 // Returns the number of currently active notifications.
42 unsigned int GetNotificationCount() const;
44 // Returns a reference to the notification at index |index|.
45 const Notification& GetNotificationAt(unsigned int index) const;
47 // Sets a one-shot callback that will be invoked when a notification has been
48 // added to the Notification UI manager. Will be invoked on the UI thread.
49 void SetNotificationAddedCallback(const base::Closure& callback);
51 // NotificationUIManager implementation.
52 void Add(const Notification& notification, Profile* profile) override;
53 bool Update(const Notification& notification, Profile* profile) override;
54 const Notification* FindById(const std::string& delegate_id,
55 ProfileID profile_id) const override;
56 bool CancelById(const std::string& delegate_id,
57 ProfileID profile_id) override;
58 std::set<std::string> GetAllIdsByProfileAndSourceOrigin(
59 ProfileID profile_id,
60 const GURL& source) override;
61 std::set<std::string> GetAllIdsByProfile(ProfileID profile_id) override;
62 bool CancelAllBySourceOrigin(const GURL& source_origin) override;
63 bool CancelAllByProfile(ProfileID profile_id) override;
64 void CancelAll() override;
66 private:
67 using NotificationPair = std::pair<Notification, ProfileID>;
68 std::vector<NotificationPair> notifications_;
70 base::Closure notification_added_callback_;
72 DISALLOW_COPY_AND_ASSIGN(StubNotificationUIManager);
75 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_