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

Side by Side Diff: ui/message_center/cocoa/notification_controller_unittest.mm

Issue 23462005: Adds the contextMessage field to notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adjust unit test due to bugfix in toast layout. Created 7 years, 3 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/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 - (NSTextField*)titleView { 79 - (NSTextField*)titleView {
80 return title_.get(); 80 return title_.get();
81 } 81 }
82 82
83 - (NSTextField*)messageView { 83 - (NSTextField*)messageView {
84 return message_.get(); 84 return message_.get();
85 } 85 }
86 86
87 - (NSTextField*)contextMessageView {
88 return contextMessage_.get();
89 }
90
87 - (NSView*)listItemView { 91 - (NSView*)listItemView {
88 return listItemView_.get(); 92 return listItemView_.get();
89 } 93 }
90 @end 94 @end
91 95
92 class NotificationControllerTest : public ui::CocoaTest { 96 class NotificationControllerTest : public ui::CocoaTest {
93 public: 97 public:
94 NSImage* TestIcon() { 98 NSImage* TestIcon() {
95 return [NSImage imageNamed:NSImageNameUser]; 99 return [NSImage imageNamed:NSImageNameUser];
96 } 100 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 269
266 TEST_F(NotificationControllerTest, List) { 270 TEST_F(NotificationControllerTest, List) {
267 message_center::RichNotificationData optional; 271 message_center::RichNotificationData optional;
268 message_center::NotificationItem item1( 272 message_center::NotificationItem item1(
269 UTF8ToUTF16("First title"), UTF8ToUTF16("first message")); 273 UTF8ToUTF16("First title"), UTF8ToUTF16("first message"));
270 optional.items.push_back(item1); 274 optional.items.push_back(item1);
271 message_center::NotificationItem item2( 275 message_center::NotificationItem item2(
272 UTF8ToUTF16("Second title"), 276 UTF8ToUTF16("Second title"),
273 UTF8ToUTF16("second slightly longer message")); 277 UTF8ToUTF16("second slightly longer message"));
274 optional.items.push_back(item2); 278 optional.items.push_back(item2);
279 optional.context_message = UTF8ToUTF16("Context Message");
275 280
276 scoped_ptr<message_center::Notification> notification( 281 scoped_ptr<message_center::Notification> notification(
277 new message_center::Notification( 282 new message_center::Notification(
278 message_center::NOTIFICATION_TYPE_BASE_FORMAT, 283 message_center::NOTIFICATION_TYPE_BASE_FORMAT,
279 "an_id", 284 "an_id",
280 UTF8ToUTF16("Notification Title"), 285 UTF8ToUTF16("Notification Title"),
281 UTF8ToUTF16("Notification Message - should be hidden"), 286 UTF8ToUTF16("Notification Message - should be hidden"),
282 gfx::Image(), 287 gfx::Image(),
283 string16(), 288 string16(),
284 message_center::NotifierId(), 289 message_center::NotifierId(),
285 optional, 290 optional,
286 NULL)); 291 NULL));
287 292
288 MockMessageCenter message_center; 293 MockMessageCenter message_center;
289 base::scoped_nsobject<MCNotificationController> controller( 294 base::scoped_nsobject<MCNotificationController> controller(
290 [[MCNotificationController alloc] initWithNotification:notification.get() 295 [[MCNotificationController alloc] initWithNotification:notification.get()
291 messageCenter:&message_center]); 296 messageCenter:&message_center]);
292 [controller view]; 297 [controller view];
293 298
294 EXPECT_FALSE([[controller titleView] isHidden]); 299 EXPECT_FALSE([[controller titleView] isHidden]);
295 EXPECT_TRUE([[controller messageView] isHidden]); 300 EXPECT_TRUE([[controller messageView] isHidden]);
301 EXPECT_FALSE([[controller contextMessageView] isHidden]);
296 302
297 EXPECT_EQ(2u, [[[controller listItemView] subviews] count]); 303 EXPECT_EQ(2u, [[[controller listItemView] subviews] count]);
298 EXPECT_LT(NSMaxY([[controller listItemView] frame]), 304 EXPECT_LT(NSMaxY([[controller listItemView] frame]),
299 NSMinY([[controller titleView] frame])); 305 NSMinY([[controller titleView] frame]));
300 } 306 }
OLDNEW
« no previous file with comments | « ui/message_center/cocoa/notification_controller.mm ('k') | ui/message_center/cocoa/popup_collection_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698