| Index: chrome/browser/download/notification/download_item_notification_unittest.cc
|
| diff --git a/chrome/browser/download/notification/download_item_notification_unittest.cc b/chrome/browser/download/notification/download_item_notification_unittest.cc
|
| index 52c885a2f79cf125015d45e8a322af5e2707e1ef..30a497b0e52eaeafa06f51ac066e66b3c85ece9e 100644
|
| --- a/chrome/browser/download/notification/download_item_notification_unittest.cc
|
| +++ b/chrome/browser/download/notification/download_item_notification_unittest.cc
|
| @@ -35,6 +35,26 @@ const base::FilePath::CharType kDownloadItemTargetPathString[] =
|
|
|
| namespace test {
|
|
|
| +class MockMessageCenter : public message_center::FakeMessageCenter {
|
| + public:
|
| + MockMessageCenter() {}
|
| + ~MockMessageCenter() override {}
|
| +
|
| + void AddVisibleNotification(message_center::Notification* notification) {
|
| + visible_notifications_.insert(notification);
|
| + }
|
| +
|
| + const message_center::NotificationList::Notifications&
|
| + GetVisibleNotifications() override {
|
| + return visible_notifications_;
|
| + }
|
| +
|
| + private:
|
| + message_center::NotificationList::Notifications visible_notifications_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(MockMessageCenter);
|
| +};
|
| +
|
| class DownloadItemNotificationTest : public testing::Test {
|
| public:
|
| DownloadItemNotificationTest()
|
| @@ -57,6 +77,10 @@ class DownloadItemNotificationTest : public testing::Test {
|
| download_notification_manager_.reset(
|
| new DownloadNotificationManagerForProfile(profile_, nullptr));
|
|
|
| + message_center_.reset(new MockMessageCenter());
|
| + download_notification_manager_->OverrideMessageCenterForTest(
|
| + message_center_.get());
|
| +
|
| base::FilePath download_item_target_path(kDownloadItemTargetPathString);
|
| download_item_.reset(new NiceMock<content::MockDownloadItem>());
|
| ON_CALL(*download_item_, GetId()).WillByDefault(Return(12345));
|
| @@ -135,6 +159,8 @@ class DownloadItemNotificationTest : public testing::Test {
|
| download_notification_manager_->OnNewDownloadReady(download_item_.get());
|
| download_item_notification_ =
|
| download_notification_manager_->items_[download_item_.get()];
|
| + message_center_->AddVisibleNotification(
|
| + download_item_notification_->notification_.get());
|
| }
|
|
|
| base::MessageLoopForUI message_loop_;
|
| @@ -146,6 +172,7 @@ class DownloadItemNotificationTest : public testing::Test {
|
| scoped_ptr<NiceMock<content::MockDownloadItem>> download_item_;
|
| scoped_ptr<DownloadNotificationManagerForProfile>
|
| download_notification_manager_;
|
| + scoped_ptr<MockMessageCenter> message_center_;
|
| DownloadItemNotification* download_item_notification_;
|
| };
|
|
|
|
|