| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 notification->set_image(gfx::Image([image retain])); | 255 notification->set_image(gfx::Image([image retain])); |
| 256 | 256 |
| 257 MockMessageCenter message_center; | 257 MockMessageCenter message_center; |
| 258 | 258 |
| 259 base::scoped_nsobject<MCNotificationController> controller( | 259 base::scoped_nsobject<MCNotificationController> controller( |
| 260 [[MCNotificationController alloc] initWithNotification:notification.get() | 260 [[MCNotificationController alloc] initWithNotification:notification.get() |
| 261 messageCenter:&message_center]); | 261 messageCenter:&message_center]); |
| 262 [controller view]; | 262 [controller view]; |
| 263 | 263 |
| 264 ASSERT_EQ(1u, [[controller bottomSubviews] count]); | 264 ASSERT_EQ(1u, [[controller bottomSubviews] count]); |
| 265 ASSERT_TRUE([[[controller bottomSubviews] lastObject] | 265 ASSERT_TRUE([[[[controller bottomSubviews] lastObject] contentView] |
| 266 isKindOfClass:[NSImageView class]]); | 266 isKindOfClass:[NSImageView class]]); |
| 267 EXPECT_EQ(image, [[[controller bottomSubviews] lastObject] image]); | 267 EXPECT_EQ(image, |
| 268 [[[[controller bottomSubviews] lastObject] contentView] image]); |
| 268 } | 269 } |
| 269 | 270 |
| 270 TEST_F(NotificationControllerTest, List) { | 271 TEST_F(NotificationControllerTest, List) { |
| 271 message_center::RichNotificationData optional; | 272 message_center::RichNotificationData optional; |
| 272 message_center::NotificationItem item1( | 273 message_center::NotificationItem item1( |
| 273 UTF8ToUTF16("First title"), UTF8ToUTF16("first message")); | 274 UTF8ToUTF16("First title"), UTF8ToUTF16("first message")); |
| 274 optional.items.push_back(item1); | 275 optional.items.push_back(item1); |
| 275 message_center::NotificationItem item2( | 276 message_center::NotificationItem item2( |
| 276 UTF8ToUTF16("Second title"), | 277 UTF8ToUTF16("Second title"), |
| 277 UTF8ToUTF16("second slightly longer message")); | 278 UTF8ToUTF16("second slightly longer message")); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 301 [controller view]; | 302 [controller view]; |
| 302 | 303 |
| 303 EXPECT_FALSE([[controller titleView] isHidden]); | 304 EXPECT_FALSE([[controller titleView] isHidden]); |
| 304 EXPECT_TRUE([[controller messageView] isHidden]); | 305 EXPECT_TRUE([[controller messageView] isHidden]); |
| 305 EXPECT_FALSE([[controller contextMessageView] isHidden]); | 306 EXPECT_FALSE([[controller contextMessageView] isHidden]); |
| 306 | 307 |
| 307 EXPECT_EQ(3u, [[[controller listView] subviews] count]); | 308 EXPECT_EQ(3u, [[[controller listView] subviews] count]); |
| 308 EXPECT_LT(NSMaxY([[controller listView] frame]), | 309 EXPECT_LT(NSMaxY([[controller listView] frame]), |
| 309 NSMinY([[controller titleView] frame])); | 310 NSMinY([[controller titleView] frame])); |
| 310 } | 311 } |
| OLD | NEW |