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

Unified Diff: ui/message_center/views/message_list_view_unittest.cc

Issue 2864293002: Add a regression test for crbug.com/713983. (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/message_list_view_unittest.cc
diff --git a/ui/message_center/views/message_list_view_unittest.cc b/ui/message_center/views/message_list_view_unittest.cc
index 48f54d69aa15d8e6256239f63c2c32b940ce105f..3afd6e7108b0436534541b666fef23d55054f134 100644
--- a/ui/message_center/views/message_list_view_unittest.cc
+++ b/ui/message_center/views/message_list_view_unittest.cc
@@ -448,4 +448,45 @@ TEST_F(MessageListViewTest, ClearAllClosableNotifications) {
EXPECT_EQ(0, message_list_view()->child_count());
}
+// Regression test for crbug.com/713983
+TEST_F(MessageListViewTest, RemoveWhileClearAll) {
+ message_list_view()->SetBounds(0, 0, 800, 600);
+
+ // Create dummy notifications.
+ auto* notification_view1 = CreateNotificationView(
+ Notification(NOTIFICATION_TYPE_SIMPLE, std::string(kNotificationId1),
+ base::UTF8ToUTF16("title"), base::UTF8ToUTF16("message1"),
+ gfx::Image(), base::UTF8ToUTF16("display source"), GURL(),
+ NotifierId(NotifierId::APPLICATION, "extension_id"),
+ message_center::RichNotificationData(), nullptr));
+ auto* notification_view2 = CreateNotificationView(
+ Notification(NOTIFICATION_TYPE_SIMPLE, std::string(kNotificationId2),
+ base::UTF8ToUTF16("title 2"), base::UTF8ToUTF16("message2"),
+ gfx::Image(), base::UTF8ToUTF16("display source"), GURL(),
+ NotifierId(NotifierId::APPLICATION, "extension_id"),
+ message_center::RichNotificationData(), nullptr));
+
+ message_list_view()->AddNotificationAt(notification_view1, 0);
+ EXPECT_EQ(1, message_list_view()->child_count());
+
+ RunPendingAnimations();
+
+ message_list_view()->AddNotificationAt(notification_view2, 1);
+ EXPECT_EQ(2, message_list_view()->child_count());
+
+ RunPendingAnimations();
+
+ // Call RemoveNotification()
+ EXPECT_TRUE(message_list_view()->Contains(notification_view2));
+ message_list_view()->RemoveNotification(notification_view2);
+
+ // Call "Clear All" while notification_view2 is still in message_list_view.
+ EXPECT_TRUE(message_list_view()->Contains(notification_view2));
+ message_list_view()->ClearAllClosableNotifications(
+ message_list_view()->bounds());
+
+ RunPendingAnimations();
+ EXPECT_EQ(0, message_list_view()->child_count());
+}
+
} // namespace
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698