| 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_notification_item.h" | 5 #include "chrome/browser/download/notification/download_notification_item.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/test/test_simple_task_runner.h" | 9 #include "base/test/test_simple_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 119 } |
| 120 | 120 |
| 121 const Notification* notification() const { | 121 const Notification* notification() const { |
| 122 return ui_manager_->FindById(download_notification_item_->watcher_->id(), | 122 return ui_manager_->FindById(download_notification_item_->watcher_->id(), |
| 123 NotificationUIManager::GetProfileID(profile_)); | 123 NotificationUIManager::GetProfileID(profile_)); |
| 124 } | 124 } |
| 125 | 125 |
| 126 size_t NotificationCount() const { | 126 size_t NotificationCount() const { |
| 127 return ui_manager_ | 127 return ui_manager_ |
| 128 ->GetAllIdsByProfileAndSourceOrigin( | 128 ->GetAllIdsByProfileAndSourceOrigin( |
| 129 profile_, | 129 NotificationUIManager::GetProfileID(profile_), |
| 130 GURL(DownloadNotificationItem::kDownloadNotificationOrigin)) | 130 GURL(DownloadNotificationItem::kDownloadNotificationOrigin)) |
| 131 .size(); | 131 .size(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void RemoveNotification() { | 134 void RemoveNotification() { |
| 135 ui_manager_->CancelById(download_notification_item_->watcher_->id(), | 135 ui_manager_->CancelById(download_notification_item_->watcher_->id(), |
| 136 NotificationUIManager::GetProfileID(profile_)); | 136 NotificationUIManager::GetProfileID(profile_)); |
| 137 | 137 |
| 138 // Waits, since removing a notification may cause an async job. | 138 // Waits, since removing a notification may cause an async job. |
| 139 base::RunLoop().RunUntilIdle(); | 139 base::RunLoop().RunUntilIdle(); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 // Checks OnDownloadRemoved(). | 290 // Checks OnDownloadRemoved(). |
| 291 EXPECT_EQ(0u, delegate_.GetOnDownloadRemovedCallCount()); | 291 EXPECT_EQ(0u, delegate_.GetOnDownloadRemovedCallCount()); |
| 292 download_item_->NotifyObserversDownloadRemoved(); | 292 download_item_->NotifyObserversDownloadRemoved(); |
| 293 EXPECT_EQ(1u, delegate_.GetOnDownloadRemovedCallCount()); | 293 EXPECT_EQ(1u, delegate_.GetOnDownloadRemovedCallCount()); |
| 294 | 294 |
| 295 download_item_.reset(); | 295 download_item_.reset(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 } // namespace test | 298 } // namespace test |
| OLD | NEW |