OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.
h" | 5 #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.
h" |
6 | 6 |
7 #include <tuple> | 7 #include <tuple> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // ChromeCleanerRunnerTestDelegate overrides. | 108 // ChromeCleanerRunnerTestDelegate overrides. |
109 | 109 |
110 base::Process LaunchTestProcess( | 110 base::Process LaunchTestProcess( |
111 const base::CommandLine& command_line, | 111 const base::CommandLine& command_line, |
112 const base::LaunchOptions& launch_options) override { | 112 const base::LaunchOptions& launch_options) override { |
113 command_line_ = command_line; | 113 command_line_ = command_line; |
114 // Return an invalid process. | 114 // Return an invalid process. |
115 return base::Process(); | 115 return base::Process(); |
116 } | 116 } |
117 | 117 |
| 118 void OnCleanerProcessDone( |
| 119 const ChromeCleanerRunner::ProcessStatus& process_status) override {} |
| 120 |
118 // IPC callbacks. | 121 // IPC callbacks. |
119 | 122 |
120 void OnPromptUser(std::unique_ptr<std::set<base::FilePath>> files_to_delete, | 123 void OnPromptUser(std::unique_ptr<std::set<base::FilePath>> files_to_delete, |
121 ChromePrompt::PromptUserCallback response) {} | 124 ChromePrompt::PromptUserCallback response) {} |
122 | 125 |
123 void OnConnectionClosed() {} | 126 void OnConnectionClosed() {} |
124 | 127 |
125 void OnProcessDone(ChromeCleanerRunner::ProcessStatus process_status) { | 128 void OnProcessDone(ChromeCleanerRunner::ProcessStatus process_status) { |
126 on_process_done_called_ = true; | 129 on_process_done_called_ = true; |
127 process_status_ = process_status; | 130 process_status_ = process_status; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 GetParam(); | 231 GetParam(); |
229 | 232 |
230 ASSERT_FALSE(uws_found_state == UwsFoundState::kNoUwsFound && | 233 ASSERT_FALSE(uws_found_state == UwsFoundState::kNoUwsFound && |
231 prompt_acceptance_to_send != PromptAcceptance::DENIED); | 234 prompt_acceptance_to_send != PromptAcceptance::DENIED); |
232 | 235 |
233 cleaner_process_options_.SetDoFindUws(uws_found_state != | 236 cleaner_process_options_.SetDoFindUws(uws_found_state != |
234 UwsFoundState::kNoUwsFound); | 237 UwsFoundState::kNoUwsFound); |
235 cleaner_process_options_.set_reboot_required( | 238 cleaner_process_options_.set_reboot_required( |
236 uws_found_state == UwsFoundState::kUwsFoundRebootRequired); | 239 uws_found_state == UwsFoundState::kUwsFoundRebootRequired); |
237 cleaner_process_options_.set_crash_point(crash_point); | 240 cleaner_process_options_.set_crash_point(crash_point); |
| 241 cleaner_process_options_.set_expected_user_response( |
| 242 prompt_acceptance_to_send); |
238 prompt_acceptance_to_send_ = prompt_acceptance_to_send; | 243 prompt_acceptance_to_send_ = prompt_acceptance_to_send; |
239 | 244 |
240 SetChromeCleanerRunnerTestDelegateForTesting(this); | 245 SetChromeCleanerRunnerTestDelegateForTesting(this); |
241 scoped_feature_list_.InitAndEnableFeature(kInBrowserCleanerUIFeature); | 246 scoped_feature_list_.InitAndEnableFeature(kInBrowserCleanerUIFeature); |
242 } | 247 } |
243 | 248 |
244 void CallRunChromeCleaner() { | 249 void CallRunChromeCleaner() { |
245 ChromeCleanerRunner::RunChromeCleanerAndReplyWithExitCode( | 250 ChromeCleanerRunner::RunChromeCleanerAndReplyWithExitCode( |
246 base::FilePath(FILE_PATH_LITERAL("cleaner.exe")), | 251 base::FilePath(FILE_PATH_LITERAL("cleaner.exe")), |
247 SwReporterInvocation(), ChromeMetricsStatus::kDisabled, | 252 SwReporterInvocation(), ChromeMetricsStatus::kDisabled, |
(...skipping 23 matching lines...) Expand all Loading... |
271 &test_process_command_line); | 276 &test_process_command_line); |
272 | 277 |
273 base::SpawnChildResult result = base::SpawnMultiProcessTestChild( | 278 base::SpawnChildResult result = base::SpawnMultiProcessTestChild( |
274 "MockChromeCleanerProcessMain", test_process_command_line, | 279 "MockChromeCleanerProcessMain", test_process_command_line, |
275 launch_options); | 280 launch_options); |
276 | 281 |
277 EXPECT_TRUE(result.process.IsValid()); | 282 EXPECT_TRUE(result.process.IsValid()); |
278 return std::move(result.process); | 283 return std::move(result.process); |
279 } | 284 } |
280 | 285 |
| 286 void OnCleanerProcessDone( |
| 287 const ChromeCleanerRunner::ProcessStatus& process_status) override {} |
| 288 |
281 // IPC callbacks. | 289 // IPC callbacks. |
282 | 290 |
283 // Will receive the main Mojo message from the Mock Chrome Cleaner process. | 291 // Will receive the main Mojo message from the Mock Chrome Cleaner process. |
284 void OnPromptUser(std::unique_ptr<std::set<base::FilePath>> files_to_delete, | 292 void OnPromptUser(std::unique_ptr<std::set<base::FilePath>> files_to_delete, |
285 ChromePrompt::PromptUserCallback response) { | 293 ChromePrompt::PromptUserCallback response) { |
286 on_prompt_user_called_ = true; | 294 on_prompt_user_called_ = true; |
287 received_files_to_delete_ = std::move(files_to_delete); | 295 received_files_to_delete_ = std::move(files_to_delete); |
288 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO) | 296 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO) |
289 ->PostTask(FROM_HERE, base::BindOnce(std::move(response), | 297 ->PostTask(FROM_HERE, base::BindOnce(std::move(response), |
290 prompt_acceptance_to_send_)); | 298 prompt_acceptance_to_send_)); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 UwsFound, | 396 UwsFound, |
389 ChromeCleanerRunnerTest, | 397 ChromeCleanerRunnerTest, |
390 Combine( | 398 Combine( |
391 Values(UwsFoundState::kUwsFoundRebootRequired, | 399 Values(UwsFoundState::kUwsFoundRebootRequired, |
392 UwsFoundState::kUwsFoundNoRebootRequired), | 400 UwsFoundState::kUwsFoundNoRebootRequired), |
393 Values(MockChromeCleanerProcess::CrashPoint::kNone, | 401 Values(MockChromeCleanerProcess::CrashPoint::kNone, |
394 MockChromeCleanerProcess::CrashPoint::kOnStartup, | 402 MockChromeCleanerProcess::CrashPoint::kOnStartup, |
395 MockChromeCleanerProcess::CrashPoint::kAfterConnection, | 403 MockChromeCleanerProcess::CrashPoint::kAfterConnection, |
396 MockChromeCleanerProcess::CrashPoint::kAfterRequestSent, | 404 MockChromeCleanerProcess::CrashPoint::kAfterRequestSent, |
397 MockChromeCleanerProcess::CrashPoint::kAfterResponseReceived), | 405 MockChromeCleanerProcess::CrashPoint::kAfterResponseReceived), |
398 Values(PromptAcceptance::DENIED, PromptAcceptance::ACCEPTED))); | 406 Values(PromptAcceptance::DENIED, |
| 407 PromptAcceptance::ACCEPTED_WITH_LOGS, |
| 408 PromptAcceptance::ACCEPTED_WITHOUT_LOGS))); |
399 | 409 |
400 } // namespace | 410 } // namespace |
401 } // namespace safe_browsing | 411 } // namespace safe_browsing |
OLD | NEW |