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

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

Issue 142413005: Add an empty message to the notification center. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adds one more nit fix. Created 6 years, 11 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 | « ui/message_center/cocoa/tray_view_controller.mm ('k') | ui/message_center/message_center_style.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/cocoa/tray_view_controller_unittest.mm
diff --git a/ui/message_center/cocoa/tray_view_controller_unittest.mm b/ui/message_center/cocoa/tray_view_controller_unittest.mm
index 6977ece97d8ec063a3fa11395fe3a11a746f2542..9fdb4fb60af49be9206e8c5475dc7930a2df292a 100644
--- a/ui/message_center/cocoa/tray_view_controller_unittest.mm
+++ b/ui/message_center/cocoa/tray_view_controller_unittest.mm
@@ -98,7 +98,10 @@ TEST_F(TrayViewControllerTest, AddRemoveOne) {
center_->RemoveNotification("1", true);
[tray_ onMessageCenterTrayChanged];
EXPECT_EQ(0u, [[view subviews] count]);
- EXPECT_CGFLOAT_EQ(0, NSHeight([view frame]));
+ // The empty tray is now 100px tall to accommodate
+ // the empty message.
+ EXPECT_CGFLOAT_EQ(message_center::kMinScrollViewHeight,
+ NSHeight([view frame]));
}
TEST_F(TrayViewControllerTest, AddThreeClearAll) {
@@ -146,7 +149,10 @@ TEST_F(TrayViewControllerTest, AddThreeClearAll) {
[tray_ onMessageCenterTrayChanged];
EXPECT_EQ(0u, [[view subviews] count]);
- EXPECT_CGFLOAT_EQ(0, NSHeight([view frame]));
+ // The empty tray is now 100px tall to accommodate
+ // the empty message.
+ EXPECT_CGFLOAT_EQ(message_center::kMinScrollViewHeight,
+ NSHeight([view frame]));
}
TEST_F(TrayViewControllerTest, NoClearAllWhenNoNotifications) {
@@ -244,4 +250,30 @@ TEST_F(TrayViewControllerTest, Settings) {
EXPECT_EQ(trayHeight, NSHeight([[tray_ view] frame]));
}
+TEST_F(TrayViewControllerTest, EmptyCenter) {
+ EXPECT_FALSE([[tray_ emptyDescription] isHidden]);
+
+ // With no notifications, the divider should be hidden.
+ EXPECT_TRUE([[tray_ divider] isHidden]);
+ EXPECT_TRUE([[tray_ scrollView] isHidden]);
+
+ scoped_ptr<message_center::Notification> notification;
+ notification.reset(new message_center::Notification(
+ message_center::NOTIFICATION_TYPE_SIMPLE,
+ "1",
+ ASCIIToUTF16("First notification"),
+ ASCIIToUTF16("This is a simple test."),
+ gfx::Image(),
+ base::string16(),
+ DummyNotifierId(),
+ message_center::RichNotificationData(),
+ NULL));
+ center_->AddNotification(notification.Pass());
+ [tray_ onMessageCenterTrayChanged];
+
+ EXPECT_FALSE([[tray_ divider] isHidden]);
+ EXPECT_FALSE([[tray_ scrollView] isHidden]);
+ EXPECT_TRUE([[tray_ emptyDescription] isHidden]);
+}
+
} // namespace message_center
« no previous file with comments | « ui/message_center/cocoa/tray_view_controller.mm ('k') | ui/message_center/message_center_style.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698