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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 // Attempts to download a file to a read-only folder, based on information | 1034 // Attempts to download a file to a read-only folder, based on information |
1035 // in |download_info|. | 1035 // in |download_info|. |
1036 void DownloadFilesToReadonlyFolder(size_t count, | 1036 void DownloadFilesToReadonlyFolder(size_t count, |
1037 DownloadInfo* download_info) { | 1037 DownloadInfo* download_info) { |
1038 DownloadFilesCheckErrorsSetup(); | 1038 DownloadFilesCheckErrorsSetup(); |
1039 | 1039 |
1040 // Make the test folder unwritable. | 1040 // Make the test folder unwritable. |
1041 base::FilePath destination_folder = GetDownloadDirectory(browser()); | 1041 base::FilePath destination_folder = GetDownloadDirectory(browser()); |
1042 DVLOG(1) << " " << __FUNCTION__ << "()" | 1042 DVLOG(1) << " " << __FUNCTION__ << "()" |
1043 << " folder = '" << destination_folder.value() << "'"; | 1043 << " folder = '" << destination_folder.value() << "'"; |
1044 file_util::PermissionRestorer permission_restorer(destination_folder); | 1044 base::FilePermissionRestorer permission_restorer(destination_folder); |
1045 EXPECT_TRUE(file_util::MakeFileUnwritable(destination_folder)); | 1045 EXPECT_TRUE(base::MakeFileUnwritable(destination_folder)); |
1046 | 1046 |
1047 for (size_t i = 0; i < count; ++i) { | 1047 for (size_t i = 0; i < count; ++i) { |
1048 DownloadFilesCheckErrorsLoopBody(download_info[i], i); | 1048 DownloadFilesCheckErrorsLoopBody(download_info[i], i); |
1049 } | 1049 } |
1050 } | 1050 } |
1051 | 1051 |
1052 // A mock install prompt that simulates the user allowing an install request. | 1052 // A mock install prompt that simulates the user allowing an install request. |
1053 void SetAllowMockInstallPrompt() { | 1053 void SetAllowMockInstallPrompt() { |
1054 download_crx_util::SetMockInstallPromptForTesting( | 1054 download_crx_util::SetMockInstallPromptForTesting( |
1055 scoped_ptr<ExtensionInstallPrompt>( | 1055 scoped_ptr<ExtensionInstallPrompt>( |
(...skipping 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3391 *(downloads[0]))); | 3391 *(downloads[0]))); |
3392 | 3392 |
3393 // Begin feedback and check that the file is "stolen". | 3393 // Begin feedback and check that the file is "stolen". |
3394 download_protection_service->feedback_service()->BeginFeedbackForDownload( | 3394 download_protection_service->feedback_service()->BeginFeedbackForDownload( |
3395 downloads[0]); | 3395 downloads[0]); |
3396 std::vector<DownloadItem*> updated_downloads; | 3396 std::vector<DownloadItem*> updated_downloads; |
3397 GetDownloads(browser(), &updated_downloads); | 3397 GetDownloads(browser(), &updated_downloads); |
3398 ASSERT_TRUE(updated_downloads.empty()); | 3398 ASSERT_TRUE(updated_downloads.empty()); |
3399 } | 3399 } |
3400 #endif | 3400 #endif |
OLD | NEW |