Index: ui/message_center/message_center_tray_unittest.cc |
diff --git a/ui/message_center/message_center_tray_unittest.cc b/ui/message_center/message_center_tray_unittest.cc |
index 1b774f892a468a7e744de523faae42620810f11a..b8aaad38921a4989d17cd7d23f35bb985735ded4 100644 |
--- a/ui/message_center/message_center_tray_unittest.cc |
+++ b/ui/message_center/message_center_tray_unittest.cc |
@@ -57,6 +57,19 @@ class MessageCenterTrayTest : public testing::Test { |
} |
protected: |
+ void AddNotification(const std::string& id) { |
+ scoped_ptr<Notification> notification( |
+ new Notification(message_center::NOTIFICATION_TYPE_SIMPLE, |
+ id, |
+ ASCIIToUTF16("Test Web Notification"), |
+ ASCIIToUTF16("Notification message body."), |
+ gfx::Image(), |
+ ASCIIToUTF16("www.test.org"), |
+ "" /* extension id */, |
+ NULL /* optional_fields */, |
+ NULL /* delegate */)); |
+ message_center_->AddNotification(notification.Pass()); |
+ } |
scoped_ptr<MockDelegate> delegate_; |
scoped_ptr<MessageCenterTray> message_center_tray_; |
MessageCenter* message_center_; |
@@ -102,14 +115,7 @@ TEST_F(MessageCenterTrayTest, BasicPopup) { |
ASSERT_FALSE(message_center_tray_->popups_visible()); |
ASSERT_FALSE(message_center_tray_->message_center_visible()); |
- message_center_->AddNotification(message_center::NOTIFICATION_TYPE_SIMPLE, |
- "BasicPopup", |
- ASCIIToUTF16("Test Web Notification"), |
- ASCIIToUTF16("Notification message body."), |
- ASCIIToUTF16("www.test.org"), |
- "" /* extension id */, |
- NULL /* optional_fields */, |
- NULL /* delegate */); |
+ AddNotification("BasicPopup"); |
ASSERT_TRUE(message_center_tray_->popups_visible()); |
ASSERT_FALSE(message_center_tray_->message_center_visible()); |
@@ -124,14 +130,7 @@ TEST_F(MessageCenterTrayTest, MessageCenterClosesPopups) { |
ASSERT_FALSE(message_center_tray_->popups_visible()); |
ASSERT_FALSE(message_center_tray_->message_center_visible()); |
- message_center_->AddNotification(message_center::NOTIFICATION_TYPE_SIMPLE, |
- "MessageCenterClosesPopups", |
- ASCIIToUTF16("Test Web Notification"), |
- ASCIIToUTF16("Notification message body."), |
- ASCIIToUTF16("www.test.org"), |
- "" /* extension id */, |
- NULL /* optional_fields */, |
- NULL /* delegate */); |
+ AddNotification("MessageCenterClosesPopups"); |
ASSERT_TRUE(message_center_tray_->popups_visible()); |
ASSERT_FALSE(message_center_tray_->message_center_visible()); |
@@ -142,14 +141,7 @@ TEST_F(MessageCenterTrayTest, MessageCenterClosesPopups) { |
ASSERT_FALSE(message_center_tray_->popups_visible()); |
ASSERT_TRUE(message_center_tray_->message_center_visible()); |
- message_center_->AddNotification(message_center::NOTIFICATION_TYPE_SIMPLE, |
- "MessageCenterClosesPopups2", |
- ASCIIToUTF16("Test Web Notification"), |
- ASCIIToUTF16("Notification message body."), |
- ASCIIToUTF16("www.test.org"), |
- "" /* extension id */, |
- NULL /* optional_fields */, |
- NULL /* delegate */); |
+ AddNotification("MessageCenterClosesPopups2"); |
message_center_tray_->ShowPopupBubble(); |
@@ -170,14 +162,7 @@ TEST_F(MessageCenterTrayTest, ShowBubbleFails) { |
ASSERT_FALSE(message_center_tray_->popups_visible()); |
ASSERT_FALSE(message_center_tray_->message_center_visible()); |
- message_center_->AddNotification(message_center::NOTIFICATION_TYPE_SIMPLE, |
- "ShowBubbleFails", |
- ASCIIToUTF16("Test Web Notification"), |
- ASCIIToUTF16("Notification message body."), |
- ASCIIToUTF16("www.test.org"), |
- "" /* extension id */, |
- NULL /* optional_fields */, |
- NULL /* delegate */); |
+ AddNotification("ShowBubbleFails"); |
message_center_tray_->ShowPopupBubble(); |