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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()-> |
| 368 // TODO(crbug.com/697817): Convert SetManagedPrefs to take a unique_ptr. |
368 SetManagedPref(prefs::kDownloadDefaultDirectory, | 369 SetManagedPref(prefs::kDownloadDefaultDirectory, |
369 base::CreateFilePathValue(path)); | 370 base::CreateFilePathValue(path).release()); |
370 } | 371 } |
371 | 372 |
372 void DownloadTargetDeterminerTest::SetPromptForDownload(bool prompt) { | 373 void DownloadTargetDeterminerTest::SetPromptForDownload(bool prompt) { |
373 profile()->GetTestingPrefService()-> | 374 profile()->GetTestingPrefService()-> |
374 SetBoolean(prefs::kPromptForDownload, prompt); | 375 SetBoolean(prefs::kPromptForDownload, prompt); |
375 } | 376 } |
376 | 377 |
377 base::FilePath DownloadTargetDeterminerTest::GetPathInDownloadDir( | 378 base::FilePath DownloadTargetDeterminerTest::GetPathInDownloadDir( |
378 const base::FilePath::StringType& relative_path) { | 379 const base::FilePath::StringType& relative_path) { |
379 if (relative_path.empty()) | 380 if (relative_path.empty()) |
(...skipping 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2201 EXPECT_CALL(mock_plugin_filter_, MockPluginAvailable(browser_plugin.path())) | 2202 EXPECT_CALL(mock_plugin_filter_, MockPluginAvailable(browser_plugin.path())) |
2202 .WillRepeatedly(Return(false)); | 2203 .WillRepeatedly(Return(false)); |
2203 target_info = RunDownloadTargetDeterminer( | 2204 target_info = RunDownloadTargetDeterminer( |
2204 GetPathInDownloadDir(kInitialPath), item.get()); | 2205 GetPathInDownloadDir(kInitialPath), item.get()); |
2205 EXPECT_FALSE(target_info->is_filetype_handled_safely); | 2206 EXPECT_FALSE(target_info->is_filetype_handled_safely); |
2206 } | 2207 } |
2207 | 2208 |
2208 #endif // BUILDFLAG(ENABLE_PLUGINS) | 2209 #endif // BUILDFLAG(ENABLE_PLUGINS) |
2209 | 2210 |
2210 } // namespace | 2211 } // namespace |
OLD | NEW |