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

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

Issue 14631005: Enable users of NotificationUIManager to specify binary images. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase for relanding. Created 7 years, 6 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/popup_controller_unittest.mm ('k') | ui/message_center/fake_message_center.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 c32be80f8e3e21de68b5b7aaafa5b176764c296b..aa370e15170e88d9cb89a9ace878b272ed41512c 100644
--- a/ui/message_center/cocoa/tray_view_controller_unittest.mm
+++ b/ui/message_center/cocoa/tray_view_controller_unittest.mm
@@ -36,14 +36,18 @@ class TrayViewControllerTest : public ui::CocoaTest {
TEST_F(TrayViewControllerTest, AddRemoveOne) {
NSScrollView* view = [[tray_ scrollView] documentView];
EXPECT_EQ(0u, [[view subviews] count]);
- center_->AddNotification(message_center::NOTIFICATION_TYPE_SIMPLE,
- "1",
- ASCIIToUTF16("First notification"),
- ASCIIToUTF16("This is a simple test."),
- string16(),
- std::string(),
- NULL,
- NULL);
+ scoped_ptr<message_center::Notification> notification_data;
+ notification_data.reset(new message_center::Notification(
+ message_center::NOTIFICATION_TYPE_SIMPLE,
+ "1",
+ ASCIIToUTF16("First notification"),
+ ASCIIToUTF16("This is a simple test."),
+ gfx::Image(),
+ string16(),
+ std::string(),
+ NULL,
+ NULL));
+ center_->AddNotification(notification_data.Pass());
[tray_ onMessageCenterTrayChanged];
ASSERT_EQ(1u, [[view subviews] count]);
@@ -66,30 +70,40 @@ TEST_F(TrayViewControllerTest, AddRemoveOne) {
TEST_F(TrayViewControllerTest, AddThreeClearAll) {
NSScrollView* view = [[tray_ scrollView] documentView];
EXPECT_EQ(0u, [[view subviews] count]);
- center_->AddNotification(message_center::NOTIFICATION_TYPE_SIMPLE,
- "1",
- ASCIIToUTF16("First notification"),
- ASCIIToUTF16("This is a simple test."),
- string16(),
- std::string(),
- NULL,
- NULL);
- center_->AddNotification(message_center::NOTIFICATION_TYPE_SIMPLE,
- "2",
- ASCIIToUTF16("Second notification"),
- ASCIIToUTF16("This is a simple test."),
- string16(),
- std::string(),
- NULL,
- NULL);
- center_->AddNotification(message_center::NOTIFICATION_TYPE_SIMPLE,
- "3",
- ASCIIToUTF16("Third notification"),
- ASCIIToUTF16("This is a simple test."),
- string16(),
- std::string(),
- NULL,
- NULL);
+ 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(),
+ string16(),
+ std::string(),
+ NULL,
+ NULL));
+ center_->AddNotification(notification.Pass());
+ notification.reset(new message_center::Notification(
+ message_center::NOTIFICATION_TYPE_SIMPLE,
+ "2",
+ ASCIIToUTF16("Second notification"),
+ ASCIIToUTF16("This is a simple test."),
+ gfx::Image(),
+ string16(),
+ std::string(),
+ NULL,
+ NULL));
+ center_->AddNotification(notification.Pass());
+ notification.reset(new message_center::Notification(
+ message_center::NOTIFICATION_TYPE_SIMPLE,
+ "3",
+ ASCIIToUTF16("Third notification"),
+ ASCIIToUTF16("This is a simple test."),
+ gfx::Image(),
+ string16(),
+ std::string(),
+ NULL,
+ NULL));
+ center_->AddNotification(notification.Pass());
[tray_ onMessageCenterTrayChanged];
ASSERT_EQ(3u, [[view subviews] count]);
@@ -110,14 +124,18 @@ TEST_F(TrayViewControllerTest, NoClearAllWhenNoNotifications) {
NSMinX([[tray_ pauseButton] frame]));
// Add a notification.
- center_->AddNotification(message_center::NOTIFICATION_TYPE_SIMPLE,
- "1",
- ASCIIToUTF16("First notification"),
- ASCIIToUTF16("This is a simple test."),
- string16(),
- std::string(),
- NULL,
- NULL);
+ 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(),
+ string16(),
+ std::string(),
+ NULL,
+ NULL));
+ center_->AddNotification(notification.Pass());
[tray_ onMessageCenterTrayChanged];
// Clear all should now be visible.
@@ -126,14 +144,17 @@ TEST_F(TrayViewControllerTest, NoClearAllWhenNoNotifications) {
NSMinX([[tray_ pauseButton] frame]));
// Adding a second notification should keep things still visible.
- center_->AddNotification(message_center::NOTIFICATION_TYPE_SIMPLE,
- "2",
- ASCIIToUTF16("Second notification"),
- ASCIIToUTF16("This is a simple test."),
- string16(),
- std::string(),
- NULL,
- NULL);
+ notification.reset(new message_center::Notification(
+ message_center::NOTIFICATION_TYPE_SIMPLE,
+ "2",
+ ASCIIToUTF16("Second notification"),
+ ASCIIToUTF16("This is a simple test."),
+ gfx::Image(),
+ string16(),
+ std::string(),
+ NULL,
+ NULL));
+ center_->AddNotification(notification.Pass());
[tray_ onMessageCenterTrayChanged];
EXPECT_FALSE([[tray_ clearAllButton] isHidden]);
EXPECT_GT(NSMinX([[tray_ clearAllButton] frame]),
« no previous file with comments | « ui/message_center/cocoa/popup_controller_unittest.mm ('k') | ui/message_center/fake_message_center.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698