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