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

Side by Side Diff: chrome/browser/download/download_danger_prompt_browsertest.cc

Issue 2845293004: Switch SupportsUserData uses to use unique_ptr. (Closed)
Patch Set: Created 3 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h"
9 #include "build/build_config.h" 10 #include "build/build_config.h"
10 #include "chrome/browser/download/download_danger_prompt.h" 11 #include "chrome/browser/download/download_danger_prompt.h"
11 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/safe_browsing/download_protection_service.h" 13 #include "chrome/browser/safe_browsing/download_protection_service.h"
13 #include "chrome/browser/safe_browsing/test_safe_browsing_service.h" 14 #include "chrome/browser/safe_browsing/test_safe_browsing_service.h"
14 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_commands.h" 16 #include "chrome/browser/ui/browser_commands.h"
16 #include "chrome/browser/ui/browser_tabstrip.h" 17 #include "chrome/browser/ui/browser_tabstrip.h"
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" 18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
18 #include "chrome/test/base/in_process_browser_test.h" 19 #include "chrome/test/base/in_process_browser_test.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 150
150 DownloadDangerPrompt* prompt() { return prompt_; } 151 DownloadDangerPrompt* prompt() { return prompt_; }
151 152
152 private: 153 private:
153 void SetUpDownloadItemExpectations( 154 void SetUpDownloadItemExpectations(
154 const content::DownloadDangerType& danger_type, 155 const content::DownloadDangerType& danger_type,
155 const std::string& token) { 156 const std::string& token) {
156 EXPECT_CALL(download_, GetFileNameToReportUser()).WillRepeatedly(Return( 157 EXPECT_CALL(download_, GetFileNameToReportUser()).WillRepeatedly(Return(
157 base::FilePath(FILE_PATH_LITERAL("evil.exe")))); 158 base::FilePath(FILE_PATH_LITERAL("evil.exe"))));
158 EXPECT_CALL(download_, GetDangerType()).WillRepeatedly(Return(danger_type)); 159 EXPECT_CALL(download_, GetDangerType()).WillRepeatedly(Return(danger_type));
159 DownloadProtectionService::DownloadPingToken* token_obj = 160 auto token_obj =
160 new DownloadProtectionService::DownloadPingToken(token); 161 base::MakeUnique<DownloadProtectionService::DownloadPingToken>(token);
161 download_.SetUserData(DownloadProtectionService::kDownloadPingTokenKey, 162 download_.SetUserData(DownloadProtectionService::kDownloadPingTokenKey,
162 token_obj); 163 std::move(token_obj));
163 } 164 }
164 165
165 void SetUpSafeBrowsingReportExpectations( 166 void SetUpSafeBrowsingReportExpectations(
166 bool did_proceed, 167 bool did_proceed,
167 const ClientDownloadResponse::Verdict& download_verdict, 168 const ClientDownloadResponse::Verdict& download_verdict,
168 const std::string& token, 169 const std::string& token,
169 bool from_download_api) { 170 bool from_download_api) {
170 ClientSafeBrowsingReportRequest expected_report; 171 ClientSafeBrowsingReportRequest expected_report;
171 expected_report.set_url(GURL(kTestDownloadUrl).spec()); 172 expected_report.set_url(GURL(kTestDownloadUrl).spec());
172 if (from_download_api) 173 if (from_download_api)
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 335
335 // Prefix for test instantiations intentionally left blank since the test 336 // Prefix for test instantiations intentionally left blank since the test
336 // fixture class has a single parameterization. 337 // fixture class has a single parameterization.
337 INSTANTIATE_TEST_CASE_P(, 338 INSTANTIATE_TEST_CASE_P(,
338 DownloadDangerPromptTest, 339 DownloadDangerPromptTest,
339 ::testing::Values(SecondaryUiMd::ENABLED, 340 ::testing::Values(SecondaryUiMd::ENABLED,
340 SecondaryUiMd::DISABLED), 341 SecondaryUiMd::DISABLED),
341 &SecondaryUiMdStatusToString); 342 &SecondaryUiMdStatusToString);
342 343
343 } // namespace safe_browsing 344 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/download/chrome_download_manager_delegate.cc ('k') | chrome/browser/download/download_history.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698