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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 // system :-{. | 546 // system :-{. |
547 } | 547 } |
548 | 548 |
549 // Does DownloadStopped remove Download from appropriate queues? | 549 // Does DownloadStopped remove Download from appropriate queues? |
550 // This test tests persisted downloads. | 550 // This test tests persisted downloads. |
551 TEST_F(DownloadManagerTest, OnDownloadStopped_Persisted) { | 551 TEST_F(DownloadManagerTest, OnDownloadStopped_Persisted) { |
552 // Put a mock we have a handle to on the download manager. | 552 // Put a mock we have a handle to on the download manager. |
553 content::MockDownloadItem& item(AddItemToManager()); | 553 content::MockDownloadItem& item(AddItemToManager()); |
554 int download_id = item.GetId(); | 554 int download_id = item.GetId(); |
555 int64 db_handle = 0x7; | 555 int64 db_handle = 0x7; |
| 556 EXPECT_CALL(item, GetExternalData(_)) |
| 557 .WillOnce(Return(static_cast<DownloadItem::ExternalData*>(NULL))); |
556 AddItemToHistory(item, db_handle); | 558 AddItemToHistory(item, db_handle); |
557 | 559 |
558 EXPECT_CALL(item, IsPersisted()) | 560 EXPECT_CALL(item, IsPersisted()) |
559 .WillRepeatedly(Return(true)); | 561 .WillRepeatedly(Return(true)); |
560 EXPECT_CALL(GetMockDownloadManagerDelegate(), | 562 EXPECT_CALL(GetMockDownloadManagerDelegate(), |
561 UpdateItemInPersistentStore(&item)); | 563 UpdateItemInPersistentStore(&item)); |
562 EXPECT_CALL(item, GetState()) | 564 EXPECT_CALL(item, GetState()) |
563 .WillRepeatedly(Return(DownloadItem::CANCELLED)); | 565 .WillRepeatedly(Return(DownloadItem::CANCELLED)); |
564 EXPECT_CALL(item, GetDbHandle()) | 566 EXPECT_CALL(item, GetDbHandle()) |
565 .WillRepeatedly(Return(db_handle)); | 567 .WillRepeatedly(Return(db_handle)); |
566 | 568 |
567 EXPECT_CALL(item, OffThreadCancel(&GetMockDownloadFileManager())); | 569 EXPECT_CALL(item, OffThreadCancel(&GetMockDownloadFileManager())); |
568 download_manager_->DownloadStopped(&item); | 570 download_manager_->DownloadStopped(&item); |
569 EXPECT_EQ(NULL, GetActiveDownloadItem(download_id)); | 571 EXPECT_EQ(NULL, GetActiveDownloadItem(download_id)); |
570 } | 572 } |
OLD | NEW |