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

Unified Diff: chrome/browser/download/download_target_determiner_unittest.cc

Issue 12662032: Merge SavePackageFilePicker{,ChromeOS} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r198452 Created 7 years, 7 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
Index: chrome/browser/download/download_target_determiner_unittest.cc
diff --git a/chrome/browser/download/download_target_determiner_unittest.cc b/chrome/browser/download/download_target_determiner_unittest.cc
index 7dabfe44f2b40c9ea5ea93e88afbc9fe232a0dbd..d8a2e8a3b75ec2d77cc1c5e8a05ce1da268d2dfe 100644
--- a/chrome/browser/download/download_target_determiner_unittest.cc
+++ b/chrome/browser/download/download_target_determiner_unittest.cc
@@ -233,10 +233,6 @@ class DownloadTargetDeterminerTest : public ChromeRenderViewHostTestHarness {
return download_prefs_.get();
}
- void set_last_selected_directory(const base::FilePath& path) {
- last_selected_directory_ = path;
- }
-
private:
// Verifies that |target_path|, |disposition|, |expected_danger_type| and
// |intermediate_path| matches the expectations of |test_case|. Posts
@@ -253,7 +249,6 @@ class DownloadTargetDeterminerTest : public ChromeRenderViewHostTestHarness {
NullWebContentsDelegate web_contents_delegate_;
base::ScopedTempDir test_download_dir_;
base::FilePath test_virtual_dir_;
- base::FilePath last_selected_directory_;
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
};
@@ -271,6 +266,8 @@ void DownloadTargetDeterminerTest::SetUp() {
web_contents()->SetDelegate(&web_contents_delegate_);
ASSERT_TRUE(test_download_dir_.CreateUniqueTempDir());
test_virtual_dir_ = test_download_dir().Append(FILE_PATH_LITERAL("virtual"));
+ download_prefs_->SetDownloadPath(test_download_dir());
+ download_prefs_->SetSaveFilePath(test_download_dir());
SetDefaultDownloadPath(test_download_dir());
delegate_.SetupDefaults();
}
@@ -347,8 +344,8 @@ void DownloadTargetDeterminerTest::EnableAutoOpenBasedOnExtension(
void DownloadTargetDeterminerTest::SetDefaultDownloadPath(
const base::FilePath& path) {
- profile()->GetTestingPrefService()->
- SetFilePath(prefs::kDownloadDefaultDirectory, path);
+ download_prefs()->SetDownloadPath(path);
+ download_prefs()->SetSaveFilePath(path);
}
void DownloadTargetDeterminerTest::SetManagedDownloadPath(
@@ -378,7 +375,7 @@ void DownloadTargetDeterminerTest::RunTestCase(
base::WeakPtrFactory<DownloadTargetDeterminerTest> factory(this);
base::RunLoop run_loop;
DownloadTargetDeterminer::Start(
- item, download_prefs_.get(), last_selected_directory_, delegate(),
+ item, download_prefs_.get(), delegate(),
base::Bind(&DownloadTargetDeterminerTest::DownloadTargetVerifier,
factory.GetWeakPtr(), run_loop.QuitClosure(), test_case));
run_loop.Run();
@@ -802,8 +799,6 @@ TEST_F(DownloadTargetDeterminerTest, TargetDeterminer_LastSavePath) {
};
{
- SCOPED_TRACE(testing::Message()
asanka 2013/05/07 15:15:12 Can you add a descriptive SCOPED_TRACE() here?
benjhayden 2013/05/17 20:31:54 Done.
- << "Running with empty last_selected_directory");
base::FilePath prompt_path =
GetPathInDownloadDir(FILE_PATH_LITERAL("foo.txt"));
EXPECT_CALL(*delegate(), PromptUserForDownloadPath(_, prompt_path, _));
@@ -815,7 +810,7 @@ TEST_F(DownloadTargetDeterminerTest, TargetDeterminer_LastSavePath) {
{
SCOPED_TRACE(testing::Message()
<< "Running with local last_selected_directory");
- set_last_selected_directory(test_download_dir().AppendASCII("foo"));
+ download_prefs()->SetSaveFilePath(test_download_dir().AppendASCII("foo"));
base::FilePath prompt_path =
GetPathInDownloadDir(FILE_PATH_LITERAL("foo/foo.txt"));
EXPECT_CALL(*delegate(), PromptUserForDownloadPath(_, prompt_path, _));
@@ -829,7 +824,7 @@ TEST_F(DownloadTargetDeterminerTest, TargetDeterminer_LastSavePath) {
<< "Running with virtual last_selected_directory");
base::FilePath last_selected_dir = test_virtual_dir().AppendASCII("foo");
base::FilePath virtual_path = last_selected_dir.AppendASCII("foo.txt");
- set_last_selected_directory(last_selected_dir);
+ download_prefs()->SetSaveFilePath(last_selected_dir);
EXPECT_CALL(*delegate(), PromptUserForDownloadPath(
_, last_selected_dir.AppendASCII("foo.txt"), _));
EXPECT_CALL(*delegate(), DetermineLocalPath(_, virtual_path, _))
@@ -1463,11 +1458,6 @@ TEST_F(DownloadTargetDeterminerTest,
base::FilePath full_overridden_path =
GetPathInDownloadDir(overridden_path.value());
- // The last selected directory is this one. Since the test case is a SAVE_AS
- // download, it should use this directory for the generated path.
- set_last_selected_directory(GetPathInDownloadDir(
asanka 2013/05/07 15:15:12 The purpose of this test is to verify that that wh
benjhayden 2013/05/17 20:31:54 Done.
- FILE_PATH_LITERAL("last_selected")));
-
EXPECT_CALL(*delegate(), NotifyExtensions(_, _, _))
.WillOnce(WithArg<2>(
ScheduleCallback2(overridden_path,

Powered by Google App Engine
This is Rietveld 408576698