Index: chrome/browser/background/background_contents_service_unittest.cc |
diff --git a/chrome/browser/background/background_contents_service_unittest.cc b/chrome/browser/background/background_contents_service_unittest.cc |
index 7389d9e5c1b6c72815daed894a3eebd6953a12d3..1db5fb7178b60e07798a12620e411ee515889853 100644 |
--- a/chrome/browser/background/background_contents_service_unittest.cc |
+++ b/chrome/browser/background/background_contents_service_unittest.cc |
@@ -131,8 +131,6 @@ class NotificationWaiter : public message_center::MessageCenterObserver { |
DCHECK(!run_loop_.running()); |
message_center::MessageCenter* message_center = |
message_center::MessageCenter::Get(); |
- if (message_center->HasNotification(target_id_)) |
- return; |
message_center->AddObserver(this); |
run_loop_.Run(); |
@@ -147,6 +145,12 @@ class NotificationWaiter : public message_center::MessageCenterObserver { |
run_loop_.Quit(); |
} |
+ virtual void OnNotificationUpdated( |
+ const std::string& notification_id) OVERRIDE { |
+ if (notification_id == target_id_) |
+ run_loop_.Quit(); |
+ } |
+ |
std::string target_id_; |
base::RunLoop run_loop_; |
@@ -366,4 +370,19 @@ TEST_F(BackgroundContentsServiceNotificationTest, TestShowBalloonNoIcon) { |
const Notification* notification = CreateCrashNotification(extension); |
EXPECT_FALSE(notification->icon().IsEmpty()); |
} |
+ |
+TEST_F(BackgroundContentsServiceNotificationTest, TestShowTwoBalloons) { |
+ TestingProfile profile; |
+ scoped_refptr<extensions::Extension> extension = |
+ extension_test_util::LoadManifest("app", "manifest.json"); |
+ ASSERT_TRUE(extension.get()); |
+ CreateCrashNotification(extension); |
+ CreateCrashNotification(extension); |
+ |
+ message_center::MessageCenter* message_center = |
+ message_center::MessageCenter::Get(); |
+ message_center::NotificationList::Notifications notifications = |
+ message_center->GetVisibleNotifications(); |
+ ASSERT_EQ(1u, notifications.size()); |
+} |
#endif |