Index: chrome/browser/notifications/notification_browsertest.cc |
diff --git a/chrome/browser/notifications/notification_browsertest.cc b/chrome/browser/notifications/notification_browsertest.cc |
index 3cead0397846f9fe3da2ecc7e6a9c8d9371f65d9..72c77dfa9218a39083da7702f8deac601e40d20b 100644 |
--- a/chrome/browser/notifications/notification_browsertest.cc |
+++ b/chrome/browser/notifications/notification_browsertest.cc |
@@ -150,9 +150,13 @@ class NotificationsTest : public InProcessBrowserTest { |
bool CheckOriginInSetting(const ContentSettingsForOneType& settings, |
const GURL& origin); |
- GURL GetTestPageURL() const { |
+ GURL GetTestPageURLForFile(const std::string& file) const { |
return embedded_test_server()->GetURL( |
- "/notifications/notification_tester.html"); |
+ std::string("/notifications/") + file); |
+ } |
+ |
+ GURL GetTestPageURL() const { |
+ return GetTestPageURLForFile("notification_tester.html"); |
} |
private: |
@@ -889,3 +893,31 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestNotificationInvalidIcon) { |
notification = *notifications.rbegin(); |
EXPECT_TRUE(notification->icon().IsEmpty()); |
} |
+ |
+IN_PROC_BROWSER_TEST_F(NotificationsTest, TestNotificationDoubleClose) { |
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
+ AllowAllOrigins(); |
+ |
+ ui_test_utils::NavigateToURL( |
+ browser(), GetTestPageURLForFile("notification-double-close.html")); |
+ ASSERT_EQ(0, GetNotificationPopupCount()); |
+ |
+ std::string result = CreateNotification( |
+ browser(), true, "", "Title1", "Body1", "chat"); |
+ EXPECT_NE("-1", result); |
+ |
+ ASSERT_EQ(1, GetNotificationCount()); |
+ message_center::NotificationList::Notifications notifications = |
+ message_center::MessageCenter::Get()->GetVisibleNotifications(); |
+ message_center::MessageCenter::Get()->RemoveNotification( |
+ (*notifications.rbegin())->id(), |
+ true); // by_user |
+ |
+ ASSERT_EQ(0, GetNotificationCount()); |
+ |
+ // Calling WebContents::IsCrashed() will return FALSE here, even if the WC did |
+ // crash. Work around this timing issue by creating another notification, |
+ // which requires interaction with the renderer process. |
+ result = CreateNotification(browser(), true, "", "Title1", "Body1", "chat"); |
+ EXPECT_NE("-1", result); |
+} |