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