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

Unified Diff: ui/message_center/notification_list_unittest.cc

Issue 439073002: Web Notifications should always reappear as popups when updated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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
« no previous file with comments | « ui/message_center/notification_list.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « ui/message_center/notification_list.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698