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/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 } | 512 } |
513 | 513 |
514 // Returns download id. | 514 // Returns download id. |
515 MockDownloadItemImpl& AddItemToManager() { | 515 MockDownloadItemImpl& AddItemToManager() { |
516 DownloadCreateInfo info; | 516 DownloadCreateInfo info; |
517 | 517 |
518 // Args are ignored except for download id, so everything else can be | 518 // Args are ignored except for download id, so everything else can be |
519 // null. | 519 // null. |
520 uint32 id = next_download_id_; | 520 uint32 id = next_download_id_; |
521 ++next_download_id_; | 521 ++next_download_id_; |
522 info.request_handle = DownloadRequestHandle(); | 522 info.request_handle.reset(new DownloadRequestHandle); |
523 download_manager_->CreateActiveItem(id, info); | 523 download_manager_->CreateActiveItem(id, info); |
524 DCHECK(mock_download_item_factory_->GetItem(id)); | 524 DCHECK(mock_download_item_factory_->GetItem(id)); |
525 MockDownloadItemImpl& item(*mock_download_item_factory_->GetItem(id)); | 525 MockDownloadItemImpl& item(*mock_download_item_factory_->GetItem(id)); |
526 // Satisfy expectation. If the item is created in StartDownload(), | 526 // Satisfy expectation. If the item is created in StartDownload(), |
527 // we call Start on it immediately, so we need to set that expectation | 527 // we call Start on it immediately, so we need to set that expectation |
528 // in the factory. | 528 // in the factory. |
529 scoped_ptr<DownloadRequestHandleInterface> req_handle; | 529 scoped_ptr<DownloadRequestHandleInterface> req_handle; |
530 item.Start(scoped_ptr<DownloadFile>(), req_handle.Pass()); | 530 item.Start(scoped_ptr<DownloadFile>(), req_handle.Pass()); |
531 DCHECK(id < download_urls_.size()); | 531 DCHECK(id < download_urls_.size()); |
532 EXPECT_CALL(item, GetURL()).WillRepeatedly(ReturnRef(download_urls_[id])); | 532 EXPECT_CALL(item, GetURL()).WillRepeatedly(ReturnRef(download_urls_[id])); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 EXPECT_CALL(GetMockDownloadItem(0), Remove()); | 718 EXPECT_CALL(GetMockDownloadItem(0), Remove()); |
719 EXPECT_CALL(GetMockDownloadItem(1), Remove()).Times(0); | 719 EXPECT_CALL(GetMockDownloadItem(1), Remove()).Times(0); |
720 | 720 |
721 url::Origin origin_to_clear(download_urls_[0]); | 721 url::Origin origin_to_clear(download_urls_[0]); |
722 int remove_count = download_manager_->RemoveDownloadsByOriginAndTime( | 722 int remove_count = download_manager_->RemoveDownloadsByOriginAndTime( |
723 origin_to_clear, base::Time(), base::Time::Max()); | 723 origin_to_clear, base::Time(), base::Time::Max()); |
724 EXPECT_EQ(remove_count, 1); | 724 EXPECT_EQ(remove_count, 1); |
725 } | 725 } |
726 | 726 |
727 } // namespace content | 727 } // namespace content |
OLD | NEW |