| Index: chrome/browser/notifications/notification_browsertest.cc
|
| diff --git a/chrome/browser/notifications/notification_browsertest.cc b/chrome/browser/notifications/notification_browsertest.cc
|
| index e58df65cffd7a3e03f21666cec8aa2554c042010..0da4987c58428d34acc37f6ad1f96f65085ec5e1 100644
|
| --- a/chrome/browser/notifications/notification_browsertest.cc
|
| +++ b/chrome/browser/notifications/notification_browsertest.cc
|
| @@ -122,6 +122,7 @@ class NotificationsTest : public InProcessBrowserTest {
|
|
|
| protected:
|
| int GetNotificationCount();
|
| + int GetNotificationPopupCount();
|
|
|
| void CloseBrowserWindow(Browser* browser);
|
| void CrashTab(Browser* browser, int index);
|
| @@ -164,6 +165,10 @@ int NotificationsTest::GetNotificationCount() {
|
| return message_center::MessageCenter::Get()->NotificationCount();
|
| }
|
|
|
| +int NotificationsTest::GetNotificationPopupCount() {
|
| + return message_center::MessageCenter::Get()->GetPopupNotifications().size();
|
| +}
|
| +
|
| void NotificationsTest::CloseBrowserWindow(Browser* browser) {
|
| content::WindowedNotificationObserver observer(
|
| chrome::NOTIFICATION_BROWSER_CLOSED,
|
| @@ -802,3 +807,35 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestLastUsage) {
|
| .ToDoubleT(),
|
| 13);
|
| }
|
| +
|
| +IN_PROC_BROWSER_TEST_F(NotificationsTest,
|
| + TestNotificationReplacementReappearance) {
|
| + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
|
| +
|
| + // Test that we can replace a notification using the tag, and that it will
|
| + // cause the notification to reappear as a popup again.
|
| + AllowAllOrigins();
|
| +
|
| + ui_test_utils::NavigateToURL(browser(), GetTestPageURL());
|
| +
|
| + ASSERT_EQ(0, GetNotificationPopupCount());
|
| +
|
| + std::string result = CreateNotification(
|
| + browser(), true, "abc.png", "Title1", "Body1", "chat");
|
| + EXPECT_NE("-1", result);
|
| +
|
| + ASSERT_EQ(1, GetNotificationPopupCount());
|
| +
|
| + message_center::NotificationList::Notifications notifications =
|
| + message_center::MessageCenter::Get()->GetVisibleNotifications();
|
| + message_center::MessageCenter::Get()->ClickOnNotification(
|
| + (*notifications.rbegin())->id());
|
| +
|
| + ASSERT_EQ(0, GetNotificationPopupCount());
|
| +
|
| + result = CreateNotification(
|
| + browser(), true, "abc.png", "Title2", "Body2", "chat");
|
| + EXPECT_NE("-1", result);
|
| +
|
| + ASSERT_EQ(1, GetNotificationPopupCount());
|
| +}
|
|
|