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

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: Better patch. 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
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..83aa60d0d387a305dfabf19801366938a87f373f 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();
@@ -146,6 +144,11 @@ class NotificationWaiter : public message_center::MessageCenterObserver {
if (notification_id == target_id_)
run_loop_.Quit();
}
+ virtual void OnNotificationUpdated(
Andrew T Wilson (Slow) 2014/05/19 14:02:27 blank line above this
dewittj 2014/05/20 18:18:22 Done.
+ const std::string& notification_id) OVERRIDE {
+ if (notification_id == target_id_)
+ run_loop_.Quit();
+ }
std::string target_id_;
base::RunLoop run_loop_;
@@ -366,4 +369,13 @@ 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);
Andrew T Wilson (Slow) 2014/05/19 14:02:27 Do we need to check that there's only one extensio
dewittj 2014/05/20 18:18:22 Done.
+}
#endif

Powered by Google App Engine
This is Rietveld 408576698