| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/download_history.h" | 5 #include "chrome/browser/download/download_history.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 public: | 184 public: |
| 185 // Generic callback that receives a pointer to a StrictMockDownloadItem. | 185 // Generic callback that receives a pointer to a StrictMockDownloadItem. |
| 186 typedef base::Callback<void(content::MockDownloadItem*)> DownloadItemCallback; | 186 typedef base::Callback<void(content::MockDownloadItem*)> DownloadItemCallback; |
| 187 | 187 |
| 188 DownloadHistoryTest() | 188 DownloadHistoryTest() |
| 189 : ui_thread_(content::BrowserThread::UI, &loop_), | 189 : ui_thread_(content::BrowserThread::UI, &loop_), |
| 190 manager_(new content::MockDownloadManager()), | 190 manager_(new content::MockDownloadManager()), |
| 191 history_(NULL), | 191 history_(NULL), |
| 192 manager_observer_(NULL), | 192 manager_observer_(NULL), |
| 193 download_created_index_(0) {} | 193 download_created_index_(0) {} |
| 194 ~DownloadHistoryTest() override { STLDeleteElements(&items_); } | 194 ~DownloadHistoryTest() override { base::STLDeleteElements(&items_); } |
| 195 | 195 |
| 196 protected: | 196 protected: |
| 197 void TearDown() override { download_history_.reset(); } | 197 void TearDown() override { download_history_.reset(); } |
| 198 | 198 |
| 199 content::MockDownloadManager& manager() { return *manager_.get(); } | 199 content::MockDownloadManager& manager() { return *manager_.get(); } |
| 200 content::MockDownloadItem& item(size_t index) { return *items_[index]; } | 200 content::MockDownloadItem& item(size_t index) { return *items_[index]; } |
| 201 DownloadHistory* download_history() { return download_history_.get(); } | 201 DownloadHistory* download_history() { return download_history_.get(); } |
| 202 | 202 |
| 203 void SetManagerObserver( | 203 void SetManagerObserver( |
| 204 content::DownloadManager::Observer* manager_observer) { | 204 content::DownloadManager::Observer* manager_observer) { |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 FinishCreateDownload(); | 895 FinishCreateDownload(); |
| 896 EXPECT_TRUE(DownloadHistory::IsPersisted(&item(0))); | 896 EXPECT_TRUE(DownloadHistory::IsPersisted(&item(0))); |
| 897 | 897 |
| 898 // ItemAdded should call OnDownloadUpdated, which should detect that the item | 898 // ItemAdded should call OnDownloadUpdated, which should detect that the item |
| 899 // changed while it was being added and call UpdateDownload immediately. | 899 // changed while it was being added and call UpdateDownload immediately. |
| 900 info.opened = true; | 900 info.opened = true; |
| 901 ExpectDownloadUpdated(info); | 901 ExpectDownloadUpdated(info); |
| 902 } | 902 } |
| 903 | 903 |
| 904 } // anonymous namespace | 904 } // anonymous namespace |
| OLD | NEW |