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

Unified Diff: content/browser/download/download_manager_impl_unittest.cc

Issue 10905284: Use the user's preferred downloads directory for creating the initial download file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows path check Created 8 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/download/download_manager_impl.cc ('k') | content/browser/download/save_file.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_manager_impl_unittest.cc
diff --git a/content/browser/download/download_manager_impl_unittest.cc b/content/browser/download/download_manager_impl_unittest.cc
index 56bd819408e8a3f904cc450caaf4356aecedcd02..453449e8c8442cca20b16183a2e5352fb9f08a79 100644
--- a/content/browser/download/download_manager_impl_unittest.cc
+++ b/content/browser/download/download_manager_impl_unittest.cc
@@ -37,7 +37,11 @@
#include "testing/gmock_mutant.h"
#include "testing/gtest/include/gtest/gtest.h"
+using ::testing::AllOf;
using ::testing::DoAll;
+using ::testing::Eq;
+using ::testing::Field;
+using ::testing::Pointee;
using ::testing::Ref;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -181,7 +185,8 @@ class MockDownloadManagerDelegate : public content::DownloadManagerDelegate {
MOCK_METHOD1(RemoveItemFromPersistentStore, void(DownloadItem*));
MOCK_METHOD2(RemoveItemsFromPersistentStoreBetween, void(
base::Time remove_begin, base::Time remove_end));
- MOCK_METHOD4(GetSaveDir, void(WebContents*, FilePath*, FilePath*, bool*));
+ MOCK_METHOD4(GetSaveDir, void(content::BrowserContext*,
+ FilePath*, FilePath*, bool*));
MOCK_METHOD5(ChooseSavePath, void(
WebContents*, const FilePath&, const FilePath::StringType&,
bool, const content::SavePackagePathPickedCallback&));
@@ -570,6 +575,7 @@ TEST_F(DownloadManagerTest, StartDownload) {
scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo);
scoped_ptr<content::ByteStreamReader> stream;
int32 local_id(5); // Random value
+ FilePath download_path(FILE_PATH_LITERAL("download/path"));
EXPECT_FALSE(download_manager_->GetActiveDownloadItem(local_id));
@@ -579,8 +585,15 @@ TEST_F(DownloadManagerTest, StartDownload) {
.WillOnce(Return(content::DownloadId(this, local_id)));
EXPECT_CALL(GetMockDownloadManagerDelegate(), GenerateFileHash())
.WillOnce(Return(true));
+ EXPECT_CALL(GetMockDownloadManagerDelegate(), GetSaveDir(_,_,_,_))
+ .WillOnce(SetArgPointee<2>(download_path));
+ // The CreateDownloadFile call should specify a DownloadCreateInfo that
+ // includes the result of the GetSaveDir() call.
EXPECT_CALL(GetMockDownloadFileManager(), MockCreateDownloadFile(
- info.get(), static_cast<content::ByteStreamReader*>(NULL),
+ AllOf(Eq(info.get()),
+ Pointee(Field(&DownloadCreateInfo::default_download_directory,
+ download_path))),
+ static_cast<content::ByteStreamReader*>(NULL),
download_manager_.get(), true, _, _));
download_manager_->StartDownload(info.Pass(), stream.Pass());
« no previous file with comments | « content/browser/download/download_manager_impl.cc ('k') | content/browser/download/save_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698