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

Side by Side Diff: chrome/browser/download/chrome_download_manager_delegate_unittest.cc

Issue 1513413002: Enable "Hide Extension" option when "Save Link As" on the Mac Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits. 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 "base/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 106
107 void PromptUserForDownloadPath( 107 void PromptUserForDownloadPath(
108 DownloadItem* download, 108 DownloadItem* download,
109 const base::FilePath& suggested_path, 109 const base::FilePath& suggested_path,
110 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) 110 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback)
111 override { 111 override {
112 base::FilePath return_path = MockPromptUserForDownloadPath(download, 112 base::FilePath return_path = MockPromptUserForDownloadPath(download,
113 suggested_path, 113 suggested_path,
114 callback); 114 callback);
115 callback.Run(return_path); 115 callback.Run(return_path, false);
116 } 116 }
117 117
118 MOCK_METHOD3( 118 MOCK_METHOD3(
119 MockPromptUserForDownloadPath, 119 MockPromptUserForDownloadPath,
120 base::FilePath( 120 base::FilePath(
121 content::DownloadItem*, 121 content::DownloadItem*,
122 const base::FilePath&, 122 const base::FilePath&,
123 const DownloadTargetDeterminerDelegate::FileSelectedCallback&)); 123 const DownloadTargetDeterminerDelegate::FileSelectedCallback&));
124 }; 124 };
125 125
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 const base::FilePath& path) { 246 const base::FilePath& path) {
247 pref_service_->SetFilePath(prefs::kDownloadDefaultDirectory, path); 247 pref_service_->SetFilePath(prefs::kDownloadDefaultDirectory, path);
248 pref_service_->SetFilePath(prefs::kSaveFileDefaultDirectory, path); 248 pref_service_->SetFilePath(prefs::kSaveFileDefaultDirectory, path);
249 } 249 }
250 250
251 void StoreDownloadTargetInfo(const base::Closure& closure, 251 void StoreDownloadTargetInfo(const base::Closure& closure,
252 DownloadTargetInfo* target_info, 252 DownloadTargetInfo* target_info,
253 const base::FilePath& target_path, 253 const base::FilePath& target_path,
254 DownloadItem::TargetDisposition target_disposition, 254 DownloadItem::TargetDisposition target_disposition,
255 content::DownloadDangerType danger_type, 255 content::DownloadDangerType danger_type,
256 const base::FilePath& intermediate_path) { 256 const base::FilePath& intermediate_path,
257 bool hide_file_extension) {
257 target_info->target_path = target_path; 258 target_info->target_path = target_path;
258 target_info->target_disposition = target_disposition; 259 target_info->target_disposition = target_disposition;
259 target_info->danger_type = danger_type; 260 target_info->danger_type = danger_type;
260 target_info->intermediate_path = intermediate_path; 261 target_info->intermediate_path = intermediate_path;
261 closure.Run(); 262 closure.Run();
262 } 263 }
263 264
264 void ChromeDownloadManagerDelegateTest::DetermineDownloadTarget( 265 void ChromeDownloadManagerDelegateTest::DetermineDownloadTarget(
265 DownloadItem* download_item, 266 DownloadItem* download_item,
266 DownloadTargetInfo* result) { 267 DownloadTargetInfo* result) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 CreateActiveDownloadItem(1)); 396 CreateActiveDownloadItem(1));
396 EXPECT_CALL(*download_item, GetTargetFilePath()) 397 EXPECT_CALL(*download_item, GetTargetFilePath())
397 .WillRepeatedly(ReturnRef(existing_path)); 398 .WillRepeatedly(ReturnRef(existing_path));
398 EXPECT_TRUE(CheckForFileExistence(download_item.get())); 399 EXPECT_TRUE(CheckForFileExistence(download_item.get()));
399 400
400 download_item.reset(CreateActiveDownloadItem(1)); 401 download_item.reset(CreateActiveDownloadItem(1));
401 EXPECT_CALL(*download_item, GetTargetFilePath()) 402 EXPECT_CALL(*download_item, GetTargetFilePath())
402 .WillRepeatedly(ReturnRef(non_existent_path)); 403 .WillRepeatedly(ReturnRef(non_existent_path));
403 EXPECT_FALSE(CheckForFileExistence(download_item.get())); 404 EXPECT_FALSE(CheckForFileExistence(download_item.get()));
404 } 405 }
OLDNEW
« no previous file with comments | « chrome/browser/download/chrome_download_manager_delegate.cc ('k') | chrome/browser/download/download_file_picker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698