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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ui/message_center/cocoa/notification_controller.h" 5 #import "ui/message_center/cocoa/notification_controller.h"
6 6
7 #include "base/memory/scoped_nsobject.h" 7 #include "base/memory/scoped_nsobject.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 [[MCNotificationController alloc] initWithNotification:notification.get() 132 [[MCNotificationController alloc] initWithNotification:notification.get()
133 messageCenter:&messageCenter]); 133 messageCenter:&messageCenter]);
134 [controller view]; 134 [controller view];
135 135
136 [[controller closeButton] performClick:nil]; 136 [[controller closeButton] performClick:nil];
137 137
138 EXPECT_EQ(1, messageCenter.remove_count()); 138 EXPECT_EQ(1, messageCenter.remove_count());
139 EXPECT_EQ("an_id", messageCenter.last_removed_id()); 139 EXPECT_EQ("an_id", messageCenter.last_removed_id());
140 EXPECT_TRUE(messageCenter.last_removed_by_user()); 140 EXPECT_TRUE(messageCenter.last_removed_by_user());
141 } 141 }
142
143 TEST_F(NotificationControllerTest, Update) {
144 scoped_ptr<message_center::Notification> notification(
145 new message_center::Notification(
146 message_center::NOTIFICATION_TYPE_SIMPLE,
147 "",
148 ASCIIToUTF16("A simple title"),
149 ASCIIToUTF16("This message isn't too long and should fit in the"
150 "default bounds."),
151 string16(),
152 std::string(),
153 NULL));
154 scoped_nsobject<MCNotificationController> controller(
155 [[MCNotificationController alloc] initWithNotification:notification.get()
156 messageCenter:NULL]);
157
158 // Set up the default layout.
159 [controller view];
160 EXPECT_EQ(NSHeight([[controller view] frame]),
161 message_center::kNotificationIconSize);
162 EXPECT_FALSE([[controller iconView] image]);
163
164 // Update the icon.
165 notification->set_icon(gfx::Image([TestIcon() retain]));
166 [controller updateNotification:notification.get()];
167 EXPECT_EQ(TestIcon(), [[controller iconView] image]);
168 EXPECT_EQ(NSHeight([[controller view] frame]),
169 message_center::kNotificationIconSize);
170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698