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

Unified Diff: chrome/browser/background/background_contents_service_unittest.cc

Issue 294473002: Allow extension crash notifications to replace each other. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nits Created 6 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 | « chrome/browser/background/background_contents_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/browser/background/background_contents_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698