| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 void CreateDownloadHistory(scoped_ptr<InfoVector> infos) { | 229 void CreateDownloadHistory(scoped_ptr<InfoVector> infos) { |
| 230 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 230 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 231 CHECK(infos.get()); | 231 CHECK(infos.get()); |
| 232 EXPECT_CALL(manager(), AddObserver(_)).WillOnce(WithArg<0>(Invoke( | 232 EXPECT_CALL(manager(), AddObserver(_)).WillOnce(WithArg<0>(Invoke( |
| 233 this, &DownloadHistoryTest::SetManagerObserver))); | 233 this, &DownloadHistoryTest::SetManagerObserver))); |
| 234 EXPECT_CALL(manager(), RemoveObserver(_)); | 234 EXPECT_CALL(manager(), RemoveObserver(_)); |
| 235 download_created_index_ = 0; | 235 download_created_index_ = 0; |
| 236 for (size_t index = 0; index < infos->size(); ++index) { | 236 for (size_t index = 0; index < infos->size(); ++index) { |
| 237 const history::DownloadRow& row = infos->at(index); | 237 const history::DownloadRow& row = infos->at(index); |
| 238 content::MockDownloadManager::CreateDownloadItemAdapter adapter( | 238 content::MockDownloadManager::CreateDownloadItemAdapter adapter( |
| 239 history::ToContentDownloadId(row.id), | 239 history::ToContentDownloadId(row.id), row.current_path, |
| 240 row.current_path, | 240 row.target_path, row.url_chain, row.referrer_url, row.mime_type, |
| 241 row.target_path, | 241 row.original_mime_type, row.start_time, row.end_time, row.etag, |
| 242 row.url_chain, | 242 row.last_modified, row.received_bytes, row.total_bytes, std::string(), |
| 243 row.referrer_url, | |
| 244 row.mime_type, | |
| 245 row.original_mime_type, | |
| 246 row.start_time, | |
| 247 row.end_time, | |
| 248 row.etag, | |
| 249 row.last_modified, | |
| 250 row.received_bytes, | |
| 251 row.total_bytes, | |
| 252 history::ToContentDownloadState(row.state), | 243 history::ToContentDownloadState(row.state), |
| 253 history::ToContentDownloadDangerType(row.danger_type), | 244 history::ToContentDownloadDangerType(row.danger_type), |
| 254 history::ToContentDownloadInterruptReason(row.interrupt_reason), | 245 history::ToContentDownloadInterruptReason(row.interrupt_reason), |
| 255 row.opened); | 246 row.opened); |
| 256 EXPECT_CALL(manager(), MockCreateDownloadItem(adapter)) | 247 EXPECT_CALL(manager(), MockCreateDownloadItem(adapter)) |
| 257 .WillOnce(DoAll( | 248 .WillOnce(DoAll( |
| 258 InvokeWithoutArgs( | 249 InvokeWithoutArgs( |
| 259 this, &DownloadHistoryTest::CallOnDownloadCreatedInOrder), | 250 this, &DownloadHistoryTest::CallOnDownloadCreatedInOrder), |
| 260 Return(&item(index)))); | 251 Return(&item(index)))); |
| 261 } | 252 } |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 FinishCreateDownload(); | 845 FinishCreateDownload(); |
| 855 EXPECT_TRUE(DownloadHistory::IsPersisted(&item(0))); | 846 EXPECT_TRUE(DownloadHistory::IsPersisted(&item(0))); |
| 856 | 847 |
| 857 // ItemAdded should call OnDownloadUpdated, which should detect that the item | 848 // ItemAdded should call OnDownloadUpdated, which should detect that the item |
| 858 // changed while it was being added and call UpdateDownload immediately. | 849 // changed while it was being added and call UpdateDownload immediately. |
| 859 info.opened = true; | 850 info.opened = true; |
| 860 ExpectDownloadUpdated(info); | 851 ExpectDownloadUpdated(info); |
| 861 } | 852 } |
| 862 | 853 |
| 863 } // anonymous namespace | 854 } // anonymous namespace |
| OLD | NEW |