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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 return item; | 357 return item; |
358 } | 358 } |
359 | 359 |
360 void DownloadTargetDeterminerTest::EnableAutoOpenBasedOnExtension( | 360 void DownloadTargetDeterminerTest::EnableAutoOpenBasedOnExtension( |
361 const base::FilePath& path) { | 361 const base::FilePath& path) { |
362 EXPECT_TRUE(download_prefs_->EnableAutoOpenBasedOnExtension(path)); | 362 EXPECT_TRUE(download_prefs_->EnableAutoOpenBasedOnExtension(path)); |
363 } | 363 } |
364 | 364 |
365 void DownloadTargetDeterminerTest::SetManagedDownloadPath( | 365 void DownloadTargetDeterminerTest::SetManagedDownloadPath( |
366 const base::FilePath& path) { | 366 const base::FilePath& path) { |
367 profile()->GetTestingPrefService()-> | 367 profile()->GetTestingPrefService()->SetManagedPref( |
368 // TODO(crbug.com/697817): Convert SetManagedPrefs to take a unique_ptr. | 368 prefs::kDownloadDefaultDirectory, base::CreateFilePathValue(path)); |
369 SetManagedPref(prefs::kDownloadDefaultDirectory, | |
370 base::CreateFilePathValue(path).release()); | |
371 } | 369 } |
372 | 370 |
373 void DownloadTargetDeterminerTest::SetPromptForDownload(bool prompt) { | 371 void DownloadTargetDeterminerTest::SetPromptForDownload(bool prompt) { |
374 profile()->GetTestingPrefService()-> | 372 profile()->GetTestingPrefService()-> |
375 SetBoolean(prefs::kPromptForDownload, prompt); | 373 SetBoolean(prefs::kPromptForDownload, prompt); |
376 } | 374 } |
377 | 375 |
378 base::FilePath DownloadTargetDeterminerTest::GetPathInDownloadDir( | 376 base::FilePath DownloadTargetDeterminerTest::GetPathInDownloadDir( |
379 const base::FilePath::StringType& relative_path) { | 377 const base::FilePath::StringType& relative_path) { |
380 if (relative_path.empty()) | 378 if (relative_path.empty()) |
(...skipping 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2202 EXPECT_CALL(mock_plugin_filter_, MockPluginAvailable(browser_plugin.path())) | 2200 EXPECT_CALL(mock_plugin_filter_, MockPluginAvailable(browser_plugin.path())) |
2203 .WillRepeatedly(Return(false)); | 2201 .WillRepeatedly(Return(false)); |
2204 target_info = RunDownloadTargetDeterminer( | 2202 target_info = RunDownloadTargetDeterminer( |
2205 GetPathInDownloadDir(kInitialPath), item.get()); | 2203 GetPathInDownloadDir(kInitialPath), item.get()); |
2206 EXPECT_FALSE(target_info->is_filetype_handled_safely); | 2204 EXPECT_FALSE(target_info->is_filetype_handled_safely); |
2207 } | 2205 } |
2208 | 2206 |
2209 #endif // BUILDFLAG(ENABLE_PLUGINS) | 2207 #endif // BUILDFLAG(ENABLE_PLUGINS) |
2210 | 2208 |
2211 } // namespace | 2209 } // namespace |
OLD | NEW |