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

Unified Diff: chrome/browser/notifications/notification_browsertest.cc

Issue 301713002: Web Notifications should always reappear as popups when updated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: notification_list test Created 6 years, 5 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 | ui/message_center/notification_list.cc » ('j') | ui/message_center/notification_list.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/notifications/notification_browsertest.cc
diff --git a/chrome/browser/notifications/notification_browsertest.cc b/chrome/browser/notifications/notification_browsertest.cc
index 5f4462d3158adfbd71cbc2e38c338131e3278200..b8f49418f4afe2ea37861b2ebb4392e807877adb 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,
@@ -743,17 +748,10 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest,
ASSERT_EQ(1, GetNotificationCount());
}
-// See http://crbug.com/366539
-#if defined(OS_LINUX)
-#define MAYBE_TestNotificationReplacement DISABLED_TestNotificationReplacement
-#else
-#define MAYBE_TestNotificationReplacement TestNotificationReplacement
-#endif
-
-IN_PROC_BROWSER_TEST_F(NotificationsTest, MAYBE_TestNotificationReplacement) {
+IN_PROC_BROWSER_TEST_F(NotificationsTest, TestNotificationReplacement) {
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
- // Test that we can replace a notification using the replaceId.
+ // Test that we can replace a notification using the tag.
AllowAllOrigins();
ui_test_utils::NavigateToURL(browser(), GetTestPageURL());
@@ -809,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());
+}
« no previous file with comments | « no previous file | ui/message_center/notification_list.cc » ('j') | ui/message_center/notification_list.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698