OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <map> | 5 #include <map> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 class FakeDownloadProtectionService : public DownloadProtectionService { | 159 class FakeDownloadProtectionService : public DownloadProtectionService { |
160 public: | 160 public: |
161 explicit FakeDownloadProtectionService( | 161 explicit FakeDownloadProtectionService( |
162 const SafeBrowsingTestConfiguration* test_config) | 162 const SafeBrowsingTestConfiguration* test_config) |
163 : DownloadProtectionService(nullptr), test_configuration_(test_config) {} | 163 : DownloadProtectionService(nullptr), test_configuration_(test_config) {} |
164 | 164 |
165 void CheckPPAPIDownloadRequest( | 165 void CheckPPAPIDownloadRequest( |
166 const GURL& requestor_url, | 166 const GURL& requestor_url, |
167 const base::FilePath& default_file_path, | 167 const base::FilePath& default_file_path, |
168 const std::vector<base::FilePath::StringType>& alternate_extensions, | 168 const std::vector<base::FilePath::StringType>& alternate_extensions, |
169 Profile* profile_unused, | |
170 const CheckDownloadCallback& callback) override { | 169 const CheckDownloadCallback& callback) override { |
171 const auto iter = | 170 const auto iter = |
172 test_configuration_->result_map.find(default_file_path.Extension()); | 171 test_configuration_->result_map.find(default_file_path.Extension()); |
173 if (iter != test_configuration_->result_map.end()) { | 172 if (iter != test_configuration_->result_map.end()) { |
174 callback.Run(iter->second); | 173 callback.Run(iter->second); |
175 return; | 174 return; |
176 } | 175 } |
177 | 176 |
178 for (const auto extension : alternate_extensions) { | 177 for (const auto extension : alternate_extensions) { |
179 EXPECT_EQ(base::FilePath::kExtensionSeparator, extension[0]); | 178 EXPECT_EQ(base::FilePath::kExtensionSeparator, extension[0]); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 std::make_pair(base::FilePath::StringType(FILE_PATH_LITERAL(".exe")), | 405 std::make_pair(base::FilePath::StringType(FILE_PATH_LITERAL(".exe")), |
407 DownloadProtectionService::DANGEROUS)); | 406 DownloadProtectionService::DANGEROUS)); |
408 | 407 |
409 TestSelectFileDialogFactory test_dialog_factory( | 408 TestSelectFileDialogFactory test_dialog_factory( |
410 TestSelectFileDialogFactory::NOT_REACHED, | 409 TestSelectFileDialogFactory::NOT_REACHED, |
411 TestSelectFileDialogFactory::SelectedFileInfoList()); | 410 TestSelectFileDialogFactory::SelectedFileInfoList()); |
412 RunTestViaHTTP("FileChooser_SaveAsDangerousExtensionListDisallowed"); | 411 RunTestViaHTTP("FileChooser_SaveAsDangerousExtensionListDisallowed"); |
413 } | 412 } |
414 | 413 |
415 #endif // FULL_SAFE_BROWSING | 414 #endif // FULL_SAFE_BROWSING |
OLD | NEW |