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

Unified Diff: chrome/browser/push_messaging/push_messaging_browsertest.cc

Issue 1149243005: Automatically close the default push notification when a real one appears. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | chrome/browser/push_messaging/push_messaging_notification_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/push_messaging/push_messaging_browsertest.cc
diff --git a/chrome/browser/push_messaging/push_messaging_browsertest.cc b/chrome/browser/push_messaging/push_messaging_browsertest.cc
index b03f0825b18d8b21aefc31a8bb12c1275775a298..0cd926f9a726844ba8d69f100cbda892977ad60f 100644
--- a/chrome/browser/push_messaging/push_messaging_browsertest.cc
+++ b/chrome/browser/push_messaging/push_messaging_browsertest.cc
@@ -561,20 +561,29 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
ASSERT_TRUE(RunScript("resultQueue.pop()", &script_result, web_contents));
EXPECT_EQ("testdata", script_result);
- EXPECT_EQ(1u, notification_manager()->GetNotificationCount());
- const Notification& forced_notification =
- notification_manager()->GetNotificationAt(0);
+ ASSERT_EQ(1u, notification_manager()->GetNotificationCount());
+ {
+ const Notification& forced_notification =
+ notification_manager()->GetNotificationAt(0);
- EXPECT_EQ(kPushMessagingForcedNotificationTag, forced_notification.tag());
- EXPECT_TRUE(forced_notification.silent());
+ EXPECT_EQ(kPushMessagingForcedNotificationTag, forced_notification.tag());
+ EXPECT_TRUE(forced_notification.silent());
+ }
- // Currently, this notification will stick around until the user or webapp
- // explicitly dismisses it (though we may change this later).
+ // The notification will be automatically dismissed when the developer shows
+ // a new notification themselves at a later point in time.
message.data["data"] = "shownotification";
SendMessageAndWaitUntilHandled(app_identifier, message);
ASSERT_TRUE(RunScript("resultQueue.pop()", &script_result, web_contents));
EXPECT_EQ("shownotification", script_result);
- EXPECT_EQ(2u, notification_manager()->GetNotificationCount());
+
+ ASSERT_EQ(1u, notification_manager()->GetNotificationCount());
+ {
+ const Notification& first_notification =
+ notification_manager()->GetNotificationAt(0);
+
+ EXPECT_NE(kPushMessagingForcedNotificationTag, first_notification.tag());
+ }
notification_manager()->CancelAll();
EXPECT_EQ(0u, notification_manager()->GetNotificationCount());
« no previous file with comments | « no previous file | chrome/browser/push_messaging/push_messaging_notification_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698