| 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/popup_controller.h" | 5 #import "ui/message_center/cocoa/popup_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #import "ui/base/test/ui_cocoa_test_helper.h" | 11 #import "ui/base/test/ui_cocoa_test_helper.h" |
| 12 #include "ui/message_center/notification.h" | 12 #include "ui/message_center/notification.h" |
| 13 | 13 |
| 14 namespace message_center { | 14 namespace message_center { |
| 15 | 15 |
| 16 class PopupControllerTest : public ui::CocoaTest { | 16 class PopupControllerTest : public ui::CocoaTest { |
| 17 }; | 17 }; |
| 18 | 18 |
| 19 TEST_F(PopupControllerTest, Creation) { | 19 TEST_F(PopupControllerTest, Creation) { |
| 20 scoped_ptr<message_center::Notification> notification( | 20 scoped_ptr<message_center::Notification> notification( |
| 21 new message_center::Notification( | 21 new message_center::Notification( |
| 22 message_center::NOTIFICATION_TYPE_SIMPLE, | 22 message_center::NOTIFICATION_TYPE_SIMPLE, |
| 23 "", | 23 "", |
| 24 ASCIIToUTF16("Added to circles"), | 24 ASCIIToUTF16("Added to circles"), |
| 25 ASCIIToUTF16("Jonathan and 5 others"), | 25 ASCIIToUTF16("Jonathan and 5 others"), |
| 26 gfx::Image(), | 26 gfx::Image(), |
| 27 string16(), | 27 base::string16(), |
| 28 message_center::NotifierId(), | 28 message_center::NotifierId(), |
| 29 message_center::RichNotificationData(), | 29 message_center::RichNotificationData(), |
| 30 NULL)); | 30 NULL)); |
| 31 | 31 |
| 32 base::scoped_nsobject<MCPopupController> controller( | 32 base::scoped_nsobject<MCPopupController> controller( |
| 33 [[MCPopupController alloc] initWithNotification:notification.get() | 33 [[MCPopupController alloc] initWithNotification:notification.get() |
| 34 messageCenter:nil | 34 messageCenter:nil |
| 35 popupCollection:nil]); | 35 popupCollection:nil]); |
| 36 // Add an extra ref count for scoped_nsobject since MCPopupController will | 36 // Add an extra ref count for scoped_nsobject since MCPopupController will |
| 37 // release itself when it is being closed. | 37 // release itself when it is being closed. |
| 38 [controller retain]; | 38 [controller retain]; |
| 39 | 39 |
| 40 EXPECT_TRUE([controller window]); | 40 EXPECT_TRUE([controller window]); |
| 41 EXPECT_EQ(notification.get(), [controller notification]); | 41 EXPECT_EQ(notification.get(), [controller notification]); |
| 42 | 42 |
| 43 [controller showWindow:nil]; | 43 [controller showWindow:nil]; |
| 44 [controller close]; | 44 [controller close]; |
| 45 } | 45 } |
| 46 | 46 |
| 47 } // namespace message_center | 47 } // namespace message_center |
| OLD | NEW |