OLD | NEW |
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 324 |
325 EXPECT_FALSE([[controller titleView] isHidden]); | 325 EXPECT_FALSE([[controller titleView] isHidden]); |
326 EXPECT_TRUE([[controller messageView] isHidden]); | 326 EXPECT_TRUE([[controller messageView] isHidden]); |
327 EXPECT_FALSE([[controller contextMessageView] isHidden]); | 327 EXPECT_FALSE([[controller contextMessageView] isHidden]); |
328 | 328 |
329 EXPECT_EQ(3u, [[[controller listView] subviews] count]); | 329 EXPECT_EQ(3u, [[[controller listView] subviews] count]); |
330 EXPECT_LT(NSMaxY([[controller listView] frame]), | 330 EXPECT_LT(NSMaxY([[controller listView] frame]), |
331 NSMinY([[controller titleView] frame])); | 331 NSMinY([[controller titleView] frame])); |
332 } | 332 } |
333 | 333 |
| 334 TEST_F(NotificationControllerTest, NoMessage) { |
| 335 message_center::RichNotificationData optional; |
| 336 optional.context_message = UTF8ToUTF16("Context Message"); |
| 337 |
| 338 scoped_ptr<message_center::Notification> notification( |
| 339 new message_center::Notification( |
| 340 message_center::NOTIFICATION_TYPE_BASE_FORMAT, |
| 341 "an_id", |
| 342 UTF8ToUTF16("Notification Title"), |
| 343 UTF8ToUTF16(""), |
| 344 gfx::Image(), |
| 345 base::string16(), |
| 346 DummyNotifierId(), |
| 347 optional, |
| 348 NULL)); |
| 349 |
| 350 MockMessageCenter message_center; |
| 351 base::scoped_nsobject<MCNotificationController> controller( |
| 352 [[MCNotificationController alloc] initWithNotification:notification.get() |
| 353 messageCenter:&message_center]); |
| 354 [controller view]; |
| 355 |
| 356 EXPECT_FALSE([[controller titleView] isHidden]); |
| 357 EXPECT_TRUE([[controller messageView] isHidden]); |
| 358 EXPECT_FALSE([[controller contextMessageView] isHidden]); |
| 359 } |
| 360 |
334 } // namespace message_center | 361 } // namespace message_center |
OLD | NEW |