| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "chrome/browser/download/notification/download_item_notification.h" | 5 #include "chrome/browser/download/notification/download_item_notification.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/macros.h" | 10 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 11 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 12 #include "base/test/test_simple_task_runner.h" | 13 #include "base/test/test_simple_task_runner.h" |
| 13 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
| 14 #include "chrome/browser/download/notification/download_notification_manager.h" | 15 #include "chrome/browser/download/notification/download_notification_manager.h" |
| 15 #include "chrome/browser/notifications/notification_test_util.h" | 16 #include "chrome/browser/notifications/notification_test_util.h" |
| 16 #include "chrome/browser/notifications/platform_notification_service_impl.h" | 17 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
| 17 #include "chrome/test/base/testing_browser_process.h" | 18 #include "chrome/test/base/testing_browser_process.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 void SetUp() override { | 68 void SetUp() override { |
| 68 testing::Test::SetUp(); | 69 testing::Test::SetUp(); |
| 69 message_center::MessageCenter::Initialize(); | 70 message_center::MessageCenter::Initialize(); |
| 70 | 71 |
| 71 profile_manager_.reset( | 72 profile_manager_.reset( |
| 72 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 73 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
| 73 ASSERT_TRUE(profile_manager_->SetUp()); | 74 ASSERT_TRUE(profile_manager_->SetUp()); |
| 74 profile_ = profile_manager_->CreateTestingProfile("test-user"); | 75 profile_ = profile_manager_->CreateTestingProfile("test-user"); |
| 75 | 76 |
| 76 scoped_ptr<NotificationUIManager> ui_manager(new StubNotificationUIManager); | 77 scoped_ptr<NotificationUIManager> ui_manager(new StubNotificationUIManager); |
| 77 TestingBrowserProcess::GetGlobal()-> | 78 TestingBrowserProcess::GetGlobal()->SetNotificationUIManager( |
| 78 SetNotificationUIManager(ui_manager.Pass()); | 79 std::move(ui_manager)); |
| 79 | 80 |
| 80 download_notification_manager_.reset( | 81 download_notification_manager_.reset( |
| 81 new DownloadNotificationManagerForProfile(profile_, nullptr)); | 82 new DownloadNotificationManagerForProfile(profile_, nullptr)); |
| 82 | 83 |
| 83 message_center_.reset(new MockMessageCenter()); | 84 message_center_.reset(new MockMessageCenter()); |
| 84 download_notification_manager_->OverrideMessageCenterForTest( | 85 download_notification_manager_->OverrideMessageCenterForTest( |
| 85 message_center_.get()); | 86 message_center_.get()); |
| 86 | 87 |
| 87 base::FilePath download_item_target_path(kDownloadItemTargetPathString); | 88 base::FilePath download_item_target_path(kDownloadItemTargetPathString); |
| 88 download_item_.reset(new NiceMock<content::MockDownloadItem>()); | 89 download_item_.reset(new NiceMock<content::MockDownloadItem>()); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 EXPECT_CALL(*download_item_, GetState()) | 295 EXPECT_CALL(*download_item_, GetState()) |
| 295 .WillRepeatedly(Return(content::DownloadItem::COMPLETE)); | 296 .WillRepeatedly(Return(content::DownloadItem::COMPLETE)); |
| 296 EXPECT_CALL(*download_item_, IsDone()).WillRepeatedly(Return(true)); | 297 EXPECT_CALL(*download_item_, IsDone()).WillRepeatedly(Return(true)); |
| 297 download_item_->NotifyObserversDownloadUpdated(); | 298 download_item_->NotifyObserversDownloadUpdated(); |
| 298 | 299 |
| 299 // Priority is updated back to normal. | 300 // Priority is updated back to normal. |
| 300 EXPECT_EQ(message_center::DEFAULT_PRIORITY, notification()->priority()); | 301 EXPECT_EQ(message_center::DEFAULT_PRIORITY, notification()->priority()); |
| 301 } | 302 } |
| 302 | 303 |
| 303 } // namespace test | 304 } // namespace test |
| OLD | NEW |