Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(737)

Side by Side Diff: content/browser/download/download_manager_impl_unittest.cc

Issue 1533583002: [Downloads] Factor out request handling logic between DRH and UD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Why aren't there tests for sniffed MIME types? Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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());
svaldez 2015/12/17 16:53:32 nit: (new DownloadRequestHandle);
asanka 2015/12/21 20:14:02 Done.
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698