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

Unified Diff: ui/message_center/cocoa/notification_controller_unittest.mm

Issue 14598015: [Mac][MC] Implement notification updates and relayouts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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: ui/message_center/cocoa/notification_controller_unittest.mm
diff --git a/ui/message_center/cocoa/notification_controller_unittest.mm b/ui/message_center/cocoa/notification_controller_unittest.mm
index 24543cf71ef79b76d4ecae78b10cf51e3b798cb6..7c4cc89b31dadb51f99957fa9954117b161975f1 100644
--- a/ui/message_center/cocoa/notification_controller_unittest.mm
+++ b/ui/message_center/cocoa/notification_controller_unittest.mm
@@ -139,3 +139,32 @@ TEST_F(NotificationControllerTest, Close) {
EXPECT_EQ("an_id", messageCenter.last_removed_id());
EXPECT_TRUE(messageCenter.last_removed_by_user());
}
+
+TEST_F(NotificationControllerTest, Update) {
+ scoped_ptr<message_center::Notification> notification(
+ new message_center::Notification(
+ message_center::NOTIFICATION_TYPE_SIMPLE,
+ "",
+ ASCIIToUTF16("A simple title"),
+ ASCIIToUTF16("This message isn't too long and should fit in the"
+ "default bounds."),
+ string16(),
+ std::string(),
+ NULL));
+ scoped_nsobject<MCNotificationController> controller(
+ [[MCNotificationController alloc] initWithNotification:notification.get()
+ messageCenter:NULL]);
+
+ // Set up the default layout.
+ [controller view];
+ EXPECT_EQ(NSHeight([[controller view] frame]),
+ message_center::kNotificationIconSize);
+ EXPECT_FALSE([[controller iconView] image]);
+
+ // Update the icon.
+ notification->set_icon(gfx::Image([TestIcon() retain]));
+ [controller updateNotification:notification.get()];
+ EXPECT_EQ(TestIcon(), [[controller iconView] image]);
+ EXPECT_EQ(NSHeight([[controller view] frame]),
+ message_center::kNotificationIconSize);
+}

Powered by Google App Engine
This is Rietveld 408576698