| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 class FakeDownloadProtectionService : public DownloadProtectionService { | 157 class FakeDownloadProtectionService : public DownloadProtectionService { |
| 158 public: | 158 public: |
| 159 explicit FakeDownloadProtectionService( | 159 explicit FakeDownloadProtectionService( |
| 160 const SafeBrowsingTestConfiguration* test_config) | 160 const SafeBrowsingTestConfiguration* test_config) |
| 161 : DownloadProtectionService(nullptr), test_configuration_(test_config) {} | 161 : DownloadProtectionService(nullptr), test_configuration_(test_config) {} |
| 162 | 162 |
| 163 void CheckPPAPIDownloadRequest( | 163 void CheckPPAPIDownloadRequest( |
| 164 const GURL& requestor_url, | 164 const GURL& requestor_url, |
| 165 const base::FilePath& default_file_path, | 165 const base::FilePath& default_file_path, |
| 166 const std::vector<base::FilePath::StringType>& alternate_extensions, | 166 const std::vector<base::FilePath::StringType>& alternate_extensions, |
| 167 bool is_extended_reporting_unused, |
| 168 bool is_incognito_unused, |
| 167 const CheckDownloadCallback& callback) override { | 169 const CheckDownloadCallback& callback) override { |
| 168 const auto iter = | 170 const auto iter = |
| 169 test_configuration_->result_map.find(default_file_path.Extension()); | 171 test_configuration_->result_map.find(default_file_path.Extension()); |
| 170 if (iter != test_configuration_->result_map.end()) { | 172 if (iter != test_configuration_->result_map.end()) { |
| 171 callback.Run(iter->second); | 173 callback.Run(iter->second); |
| 172 return; | 174 return; |
| 173 } | 175 } |
| 174 | 176 |
| 175 for (const auto extension : alternate_extensions) { | 177 for (const auto extension : alternate_extensions) { |
| 176 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... |
| 403 std::make_pair(base::FilePath::StringType(FILE_PATH_LITERAL(".exe")), | 405 std::make_pair(base::FilePath::StringType(FILE_PATH_LITERAL(".exe")), |
| 404 DownloadProtectionService::DANGEROUS)); | 406 DownloadProtectionService::DANGEROUS)); |
| 405 | 407 |
| 406 TestSelectFileDialogFactory test_dialog_factory( | 408 TestSelectFileDialogFactory test_dialog_factory( |
| 407 TestSelectFileDialogFactory::NOT_REACHED, | 409 TestSelectFileDialogFactory::NOT_REACHED, |
| 408 TestSelectFileDialogFactory::SelectedFileInfoList()); | 410 TestSelectFileDialogFactory::SelectedFileInfoList()); |
| 409 RunTestViaHTTP("FileChooser_SaveAsDangerousExtensionListDisallowed"); | 411 RunTestViaHTTP("FileChooser_SaveAsDangerousExtensionListDisallowed"); |
| 410 } | 412 } |
| 411 | 413 |
| 412 #endif // FULL_SAFE_BROWSING | 414 #endif // FULL_SAFE_BROWSING |
| OLD | NEW |