| 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 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 class FakeDownloadProtectionService : public DownloadProtectionService { | 162 class FakeDownloadProtectionService : public DownloadProtectionService { |
| 163 public: | 163 public: |
| 164 explicit FakeDownloadProtectionService( | 164 explicit FakeDownloadProtectionService( |
| 165 const SafeBrowsingTestConfiguration* test_config) | 165 const SafeBrowsingTestConfiguration* test_config) |
| 166 : DownloadProtectionService(nullptr), test_configuration_(test_config) {} | 166 : DownloadProtectionService(nullptr), test_configuration_(test_config) {} |
| 167 | 167 |
| 168 void CheckPPAPIDownloadRequest( | 168 void CheckPPAPIDownloadRequest( |
| 169 const GURL& requestor_url, | 169 const GURL& requestor_url, |
| 170 const GURL& initiating_frame_url_unused, |
| 171 content::WebContents* web_contents_unused, |
| 170 const base::FilePath& default_file_path, | 172 const base::FilePath& default_file_path, |
| 171 const std::vector<base::FilePath::StringType>& alternate_extensions, | 173 const std::vector<base::FilePath::StringType>& alternate_extensions, |
| 172 Profile* /* profile */, | 174 Profile* /* profile */, |
| 173 const CheckDownloadCallback& callback) override { | 175 const CheckDownloadCallback& callback) override { |
| 174 const auto iter = | 176 const auto iter = |
| 175 test_configuration_->result_map.find(default_file_path.Extension()); | 177 test_configuration_->result_map.find(default_file_path.Extension()); |
| 176 if (iter != test_configuration_->result_map.end()) { | 178 if (iter != test_configuration_->result_map.end()) { |
| 177 callback.Run(iter->second); | 179 callback.Run(iter->second); |
| 178 return; | 180 return; |
| 179 } | 181 } |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 std::make_pair(base::FilePath::StringType(FILE_PATH_LITERAL(".exe")), | 440 std::make_pair(base::FilePath::StringType(FILE_PATH_LITERAL(".exe")), |
| 439 DownloadProtectionService::DANGEROUS)); | 441 DownloadProtectionService::DANGEROUS)); |
| 440 | 442 |
| 441 TestSelectFileDialogFactory test_dialog_factory( | 443 TestSelectFileDialogFactory test_dialog_factory( |
| 442 TestSelectFileDialogFactory::NOT_REACHED, | 444 TestSelectFileDialogFactory::NOT_REACHED, |
| 443 TestSelectFileDialogFactory::SelectedFileInfoList()); | 445 TestSelectFileDialogFactory::SelectedFileInfoList()); |
| 444 RunTestViaHTTP("FileChooser_SaveAsDangerousExtensionListDisallowed"); | 446 RunTestViaHTTP("FileChooser_SaveAsDangerousExtensionListDisallowed"); |
| 445 } | 447 } |
| 446 | 448 |
| 447 #endif // FULL_SAFE_BROWSING | 449 #endif // FULL_SAFE_BROWSING |
| OLD | NEW |