message_center_utils_unittest.cc 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2021 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. #include "ash/system/message_center/message_center_utils.h"
  5. #include "ash/public/cpp/vm_camera_mic_constants.h"
  6. #include "ash/test/ash_test_base.h"
  7. #include "base/strings/utf_string_conversions.h"
  8. #include "ui/message_center/message_center.h"
  9. namespace ash {
  10. namespace message_center_utils {
  11. namespace {
  12. void AddNotification(const std::string& notification_id,
  13. const std::string& app_id) {
  14. message_center::MessageCenter::Get()->AddNotification(
  15. std::make_unique<message_center::Notification>(
  16. message_center::NOTIFICATION_TYPE_SIMPLE, notification_id,
  17. u"test_title", u"test message", ui::ImageModel(),
  18. /*display_source=*/std::u16string(), GURL(),
  19. message_center::NotifierId(message_center::NotifierType::APPLICATION,
  20. app_id),
  21. message_center::RichNotificationData(),
  22. new message_center::NotificationDelegate()));
  23. }
  24. } // namespace
  25. using MessageCenterUtilsTest = AshTestBase;
  26. TEST_F(MessageCenterUtilsTest, TotalNotificationCount) {
  27. EXPECT_EQ(0u, GetNotificationCount());
  28. // VM camera/mic notifications are ignored by the counter.
  29. AddNotification("0", kVmCameraMicNotifierId);
  30. EXPECT_EQ(0u, GetNotificationCount());
  31. }
  32. } // namespace message_center_utils
  33. } // namespace ash