fake_notification_manager.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright 2020 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.
  4. #ifndef ASH_COMPONENTS_PHONEHUB_FAKE_NOTIFICATION_MANAGER_H_
  5. #define ASH_COMPONENTS_PHONEHUB_FAKE_NOTIFICATION_MANAGER_H_
  6. #include <vector>
  7. #include "ash/components/phonehub/notification.h"
  8. #include "ash/components/phonehub/notification_manager.h"
  9. namespace ash {
  10. namespace phonehub {
  11. class FakeNotificationManager : public NotificationManager {
  12. public:
  13. FakeNotificationManager();
  14. ~FakeNotificationManager() override;
  15. using NotificationManager::SetNotificationsInternal;
  16. using NotificationManager::RemoveNotificationsInternal;
  17. using NotificationManager::ClearNotificationsInternal;
  18. void SetNotification(const Notification& notification);
  19. void RemoveNotification(int64_t id);
  20. const std::vector<int64_t>& dismissed_notification_ids() const {
  21. return dismissed_notification_ids_;
  22. }
  23. size_t num_notifications() const { return id_to_notification_map_.size(); }
  24. struct InlineReplyMetadata {
  25. InlineReplyMetadata(int64_t notification_id,
  26. const std::u16string& inline_reply_text);
  27. ~InlineReplyMetadata();
  28. int64_t notification_id;
  29. std::u16string inline_reply_text;
  30. };
  31. const std::vector<InlineReplyMetadata>& inline_replies() const {
  32. return inline_replies_;
  33. }
  34. private:
  35. // NotificationManager:
  36. void DismissNotification(int64_t notification_id) override;
  37. void SendInlineReply(int64_t notification_id,
  38. const std::u16string& inline_reply_text) override;
  39. std::vector<int64_t> dismissed_notification_ids_;
  40. std::vector<InlineReplyMetadata> inline_replies_;
  41. };
  42. } // namespace phonehub
  43. } // namespace ash
  44. #endif // ASH_COMPONENTS_PHONEHUB_FAKE_NOTIFICATION_MANAGER_H_