Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1252)

Side by Side Diff: chrome/test/ppapi/ppapi_filechooser_browsertest.cc

Issue 2146703002: Sample 1% url whitelisted PPAPI downloads to ping safe browsing server (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address asanka@'s comment Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 Profile* profile_unused,
167 const CheckDownloadCallback& callback) override { 168 const CheckDownloadCallback& callback) override {
168 const auto iter = 169 const auto iter =
169 test_configuration_->result_map.find(default_file_path.Extension()); 170 test_configuration_->result_map.find(default_file_path.Extension());
170 if (iter != test_configuration_->result_map.end()) { 171 if (iter != test_configuration_->result_map.end()) {
171 callback.Run(iter->second); 172 callback.Run(iter->second);
172 return; 173 return;
173 } 174 }
174 175
175 for (const auto extension : alternate_extensions) { 176 for (const auto extension : alternate_extensions) {
176 EXPECT_EQ(base::FilePath::kExtensionSeparator, extension[0]); 177 EXPECT_EQ(base::FilePath::kExtensionSeparator, extension[0]);
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 std::make_pair(base::FilePath::StringType(FILE_PATH_LITERAL(".exe")), 404 std::make_pair(base::FilePath::StringType(FILE_PATH_LITERAL(".exe")),
404 DownloadProtectionService::DANGEROUS)); 405 DownloadProtectionService::DANGEROUS));
405 406
406 TestSelectFileDialogFactory test_dialog_factory( 407 TestSelectFileDialogFactory test_dialog_factory(
407 TestSelectFileDialogFactory::NOT_REACHED, 408 TestSelectFileDialogFactory::NOT_REACHED,
408 TestSelectFileDialogFactory::SelectedFileInfoList()); 409 TestSelectFileDialogFactory::SelectedFileInfoList());
409 RunTestViaHTTP("FileChooser_SaveAsDangerousExtensionListDisallowed"); 410 RunTestViaHTTP("FileChooser_SaveAsDangerousExtensionListDisallowed");
410 } 411 }
411 412
412 #endif // FULL_SAFE_BROWSING 413 #endif // FULL_SAFE_BROWSING
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698