| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <map> | 5 #include <map> |
| 6 #include <memory> | 6 #include <memory> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 RunPendingAnimations(); | 441 RunPendingAnimations(); |
| 442 | 442 |
| 443 message_list_view()->ClearAllClosableNotifications( | 443 message_list_view()->ClearAllClosableNotifications( |
| 444 message_list_view()->bounds()); | 444 message_list_view()->bounds()); |
| 445 | 445 |
| 446 RunPendingAnimations(); | 446 RunPendingAnimations(); |
| 447 | 447 |
| 448 EXPECT_EQ(0, message_list_view()->child_count()); | 448 EXPECT_EQ(0, message_list_view()->child_count()); |
| 449 } | 449 } |
| 450 | 450 |
| 451 // Regression test for crbug.com/713983 |
| 452 TEST_F(MessageListViewTest, RemoveWhileClearAll) { |
| 453 message_list_view()->SetBounds(0, 0, 800, 600); |
| 454 |
| 455 // Create dummy notifications. |
| 456 auto* notification_view1 = CreateNotificationView( |
| 457 Notification(NOTIFICATION_TYPE_SIMPLE, std::string(kNotificationId1), |
| 458 base::UTF8ToUTF16("title"), base::UTF8ToUTF16("message1"), |
| 459 gfx::Image(), base::UTF8ToUTF16("display source"), GURL(), |
| 460 NotifierId(NotifierId::APPLICATION, "extension_id"), |
| 461 message_center::RichNotificationData(), nullptr)); |
| 462 auto* notification_view2 = CreateNotificationView( |
| 463 Notification(NOTIFICATION_TYPE_SIMPLE, std::string(kNotificationId2), |
| 464 base::UTF8ToUTF16("title 2"), base::UTF8ToUTF16("message2"), |
| 465 gfx::Image(), base::UTF8ToUTF16("display source"), GURL(), |
| 466 NotifierId(NotifierId::APPLICATION, "extension_id"), |
| 467 message_center::RichNotificationData(), nullptr)); |
| 468 |
| 469 message_list_view()->AddNotificationAt(notification_view1, 0); |
| 470 EXPECT_EQ(1, message_list_view()->child_count()); |
| 471 |
| 472 RunPendingAnimations(); |
| 473 |
| 474 message_list_view()->AddNotificationAt(notification_view2, 1); |
| 475 EXPECT_EQ(2, message_list_view()->child_count()); |
| 476 |
| 477 RunPendingAnimations(); |
| 478 |
| 479 // Call RemoveNotification() |
| 480 EXPECT_TRUE(message_list_view()->Contains(notification_view2)); |
| 481 message_list_view()->RemoveNotification(notification_view2); |
| 482 |
| 483 // Call "Clear All" while notification_view2 is still in message_list_view. |
| 484 EXPECT_TRUE(message_list_view()->Contains(notification_view2)); |
| 485 message_list_view()->ClearAllClosableNotifications( |
| 486 message_list_view()->bounds()); |
| 487 |
| 488 RunPendingAnimations(); |
| 489 EXPECT_EQ(0, message_list_view()->child_count()); |
| 490 } |
| 491 |
| 451 } // namespace | 492 } // namespace |
| OLD | NEW |