Index: ui/message_center/notification_list_unittest.cc |
diff --git a/ui/message_center/notification_list_unittest.cc b/ui/message_center/notification_list_unittest.cc |
index 637e95afaf527238508682b6860406b9f8b3d69c..823a2d59a5977384e486b67e793f8d01c4d582c9 100644 |
--- a/ui/message_center/notification_list_unittest.cc |
+++ b/ui/message_center/notification_list_unittest.cc |
@@ -528,6 +528,44 @@ TEST_F(NotificationListTest, PriorityPromotionWithPopups) { |
EXPECT_EQ(0u, GetPopupCounts()); |
} |
+TEST_F(NotificationListTest, WebNotificationUpdatePromotion) { |
+ std::string notification_id = "replaced-web-notification"; |
+ scoped_ptr<Notification> original_notification( |
+ new Notification(message_center::NOTIFICATION_TYPE_SIMPLE, |
+ notification_id, |
+ UTF8ToUTF16("Web Notification"), |
+ UTF8ToUTF16("Notification contents"), |
+ gfx::Image(), |
+ UTF8ToUTF16(kDisplaySource), |
+ NotifierId(GURL("https://example.com/")), |
+ message_center::RichNotificationData(), |
+ NULL)); |
+ |
+ EXPECT_EQ(0u, GetPopupCounts()); |
+ notification_list()->AddNotification(original_notification.Pass()); |
+ EXPECT_EQ(1u, GetPopupCounts()); |
+ |
+ notification_list()->MarkSinglePopupAsShown(notification_id, true); |
+ EXPECT_EQ(0u, GetPopupCounts()); |
+ |
+ scoped_ptr<Notification> replaced_notification( |
+ new Notification(message_center::NOTIFICATION_TYPE_SIMPLE, |
+ notification_id, |
+ UTF8ToUTF16("Web Notification Replacement"), |
+ UTF8ToUTF16("New notification contents"), |
+ gfx::Image(), |
+ UTF8ToUTF16(kDisplaySource), |
+ NotifierId(GURL("https://example.com/")), |
+ message_center::RichNotificationData(), |
+ NULL)); |
+ |
+ // Web Notifications will be re-shown as popups even if their priority didn't |
+ // change, to match the behavior of the Web Notification API. |
+ notification_list()->UpdateNotificationMessage(notification_id, |
+ replaced_notification.Pass()); |
+ EXPECT_EQ(1u, GetPopupCounts()); |
+} |
+ |
TEST_F(NotificationListTest, NotificationOrderAndPriority) { |
base::Time now = base::Time::Now(); |
message_center::RichNotificationData optional; |