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