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

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

Issue 2029903002: Add token field to ClientSafeBrowsingReportReqeust (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak comments Created 4 years, 6 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"
11 #include "base/strings/string_util.h"
11 #include "base/threading/thread_task_runner_handle.h" 12 #include "base/threading/thread_task_runner_handle.h"
12 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
13 #include "chrome/test/ppapi/ppapi_test.h" 14 #include "chrome/test/ppapi/ppapi_test.h"
14 #include "ppapi/shared_impl/test_utils.h" 15 #include "ppapi/shared_impl/test_utils.h"
15 #include "ui/shell_dialogs/select_file_dialog.h" 16 #include "ui/shell_dialogs/select_file_dialog.h"
16 #include "ui/shell_dialogs/select_file_dialog_factory.h" 17 #include "ui/shell_dialogs/select_file_dialog_factory.h"
17 #include "ui/shell_dialogs/selected_file_info.h" 18 #include "ui/shell_dialogs/selected_file_info.h"
18 19
19 #if defined(FULL_SAFE_BROWSING) 20 #if defined(FULL_SAFE_BROWSING)
20 #include "chrome/browser/safe_browsing/download_protection_service.h" 21 #include "chrome/browser/safe_browsing/download_protection_service.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 class FakeDownloadProtectionService : public DownloadProtectionService { 158 class FakeDownloadProtectionService : public DownloadProtectionService {
158 public: 159 public:
159 explicit FakeDownloadProtectionService( 160 explicit FakeDownloadProtectionService(
160 const SafeBrowsingTestConfiguration* test_config) 161 const SafeBrowsingTestConfiguration* test_config)
161 : DownloadProtectionService(nullptr), test_configuration_(test_config) {} 162 : DownloadProtectionService(nullptr), test_configuration_(test_config) {}
162 163
163 void CheckPPAPIDownloadRequest( 164 void CheckPPAPIDownloadRequest(
164 const GURL& requestor_url, 165 const GURL& requestor_url,
165 const base::FilePath& default_file_path, 166 const base::FilePath& default_file_path,
166 const std::vector<base::FilePath::StringType>& alternate_extensions, 167 const std::vector<base::FilePath::StringType>& alternate_extensions,
167 const CheckDownloadCallback& callback) override { 168 const CheckDownloadContentCallback& 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, base::EmptyString());
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]);
177 const auto iter = test_configuration_->result_map.find(extension); 178 const auto iter = test_configuration_->result_map.find(extension);
178 if (iter != test_configuration_->result_map.end()) { 179 if (iter != test_configuration_->result_map.end()) {
179 callback.Run(iter->second); 180 callback.Run(iter->second, base::EmptyString());
180 return; 181 return;
181 } 182 }
182 } 183 }
183 184
184 callback.Run(test_configuration_->default_result); 185 callback.Run(test_configuration_->default_result, base::EmptyString());
185 } 186 }
186 187
187 private: 188 private:
188 const SafeBrowsingTestConfiguration* test_configuration_; 189 const SafeBrowsingTestConfiguration* test_configuration_;
189 }; 190 };
190 191
191 class TestSafeBrowsingService 192 class TestSafeBrowsingService
192 : public safe_browsing::ServicesDelegate::ServicesCreator, 193 : public safe_browsing::ServicesDelegate::ServicesCreator,
193 public safe_browsing::SafeBrowsingService { 194 public safe_browsing::SafeBrowsingService {
194 public: 195 public:
(...skipping 208 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