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

Side by Side Diff: chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_win_unittest.cc

Issue 2906103002: Post-cleanup settings reset. (Closed)
Patch Set: Code reviews Created 3 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 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_controller_ win.h" 5 #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_ win.h"
6 6
7 #include <string> 7 #include <string>
8 #include <tuple> 8 #include <tuple>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/task_scheduler/post_task.h" 13 #include "base/task_scheduler/post_task.h"
14 #include "base/test/multiprocess_test.h" 14 #include "base/test/multiprocess_test.h"
15 #include "base/test/scoped_feature_list.h" 15 #include "base/test/scoped_feature_list.h"
16 #include "base/threading/thread_task_runner_handle.h" 16 #include "base/threading/thread_task_runner_handle.h"
17 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" 17 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_proces s_win.h" 20 #include "chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_proces s_win.h"
19 #include "chrome/browser/safe_browsing/chrome_cleaner/reporter_runner_win.h" 21 #include "chrome/browser/safe_browsing/chrome_cleaner/reporter_runner_win.h"
20 #include "chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h" 22 #include "chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h"
23 #include "chrome/test/base/testing_browser_process.h"
24 #include "chrome/test/base/testing_profile.h"
25 #include "chrome/test/base/testing_profile_manager.h"
21 #include "components/chrome_cleaner/public/constants/constants.h" 26 #include "components/chrome_cleaner/public/constants/constants.h"
22 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
23 #include "content/public/test/test_browser_thread_bundle.h" 28 #include "content/public/test/test_browser_thread_bundle.h"
24 #include "testing/gmock/include/gmock/gmock.h" 29 #include "testing/gmock/include/gmock/gmock.h"
25 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
26 #include "testing/multiprocess_func_list.h" 31 #include "testing/multiprocess_func_list.h"
27 32
28 namespace safe_browsing { 33 namespace safe_browsing {
29 namespace { 34 namespace {
30 35
31 using ::testing::Combine; 36 using ::testing::Combine;
32 using ::testing::DoAll; 37 using ::testing::DoAll;
33 using ::testing::InvokeWithoutArgs; 38 using ::testing::InvokeWithoutArgs;
34 using ::testing::SaveArg; 39 using ::testing::SaveArg;
35 using ::testing::StrictMock; 40 using ::testing::StrictMock;
41 using ::testing::UnorderedElementsAreArray;
36 using ::testing::Values; 42 using ::testing::Values;
37 using ::testing::_; 43 using ::testing::_;
38 using CrashPoint = MockChromeCleanerProcess::CrashPoint; 44 using CrashPoint = MockChromeCleanerProcess::CrashPoint;
39 using IdleReason = ChromeCleanerController::IdleReason; 45 using IdleReason = ChromeCleanerController::IdleReason;
40 using State = ChromeCleanerController::State; 46 using State = ChromeCleanerController::State;
41 using UserResponse = ChromeCleanerController::UserResponse; 47 using UserResponse = ChromeCleanerController::UserResponse;
42 48
43 class MockChromeCleanerControllerObserver 49 class MockChromeCleanerControllerObserver
44 : public ChromeCleanerController::Observer { 50 : public ChromeCleanerController::Observer {
45 public: 51 public:
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 std::move(fetched_callback) 111 std::move(fetched_callback)
106 .Run(base::FilePath(FILE_PATH_LITERAL("chrome_cleaner.exe"))); 112 .Run(base::FilePath(FILE_PATH_LITERAL("chrome_cleaner.exe")));
107 } 113 }
108 114
109 bool SafeBrowsingExtendedReportingScoutEnabled() override { 115 bool SafeBrowsingExtendedReportingScoutEnabled() override {
110 return scout_enabled_; 116 return scout_enabled_;
111 } 117 }
112 118
113 bool IsMetricsAndCrashReportingEnabled() override { return metrics_enabled_; } 119 bool IsMetricsAndCrashReportingEnabled() override { return metrics_enabled_; }
114 120
121 void InvokeTagForResetting(Profile* profile) override {
122 // This function should never be called by these tests.
123 EXPECT_TRUE(false);
124 }
125
126 void InvokeResetTaggedProfiles(std::vector<Profile*> profiles,
127 base::OnceClosure continuation) override {
128 // This function should never be called by these tests.
129 EXPECT_TRUE(false);
130 }
131
115 // ChromeCleanerRunnerTestDelegate overrides. 132 // ChromeCleanerRunnerTestDelegate overrides.
116 133
117 base::Process LaunchTestProcess( 134 base::Process LaunchTestProcess(
118 const base::CommandLine& command_line, 135 const base::CommandLine& command_line,
119 const base::LaunchOptions& launch_options) override { 136 const base::LaunchOptions& launch_options) override {
120 command_line_ = command_line; 137 command_line_ = command_line;
121 // Return an invalid process. 138 // Return an invalid process.
122 return base::Process(); 139 return base::Process();
123 } 140 }
124 141
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // configurations and mocks the user's response. 213 // configurations and mocks the user's response.
197 class ChromeCleanerControllerTest 214 class ChromeCleanerControllerTest
198 : public testing::TestWithParam< 215 : public testing::TestWithParam<
199 std::tuple<CleanerProcessStatus, 216 std::tuple<CleanerProcessStatus,
200 MockChromeCleanerProcess::CrashPoint, 217 MockChromeCleanerProcess::CrashPoint,
201 UwsFoundStatus, 218 UwsFoundStatus,
202 ChromeCleanerController::UserResponse>>, 219 ChromeCleanerController::UserResponse>>,
203 public ChromeCleanerRunnerTestDelegate, 220 public ChromeCleanerRunnerTestDelegate,
204 public ChromeCleanerControllerDelegate { 221 public ChromeCleanerControllerDelegate {
205 public: 222 public:
223 ChromeCleanerControllerTest()
224 : profile_manager_(TestingBrowserProcess::GetGlobal()) {}
206 ~ChromeCleanerControllerTest() override {} 225 ~ChromeCleanerControllerTest() override {}
207 226
208 void SetUp() override { 227 void SetUp() override {
228 ASSERT_TRUE(profile_manager_.SetUp());
229
209 std::tie(process_status_, crash_point_, uws_found_status_, user_response_) = 230 std::tie(process_status_, crash_point_, uws_found_status_, user_response_) =
210 GetParam(); 231 GetParam();
211 232
212 cleaner_process_options_.SetDoFindUws(uws_found_status_ != 233 cleaner_process_options_.SetDoFindUws(uws_found_status_ !=
213 UwsFoundStatus::kNoUwsFound); 234 UwsFoundStatus::kNoUwsFound);
214 cleaner_process_options_.set_reboot_required( 235 cleaner_process_options_.set_reboot_required(
215 uws_found_status_ == UwsFoundStatus::kUwsFoundRebootRequired); 236 uws_found_status_ == UwsFoundStatus::kUwsFoundRebootRequired);
216 cleaner_process_options_.set_crash_point(crash_point_); 237 cleaner_process_options_.set_crash_point(crash_point_);
217 238
218 controller_ = ChromeCleanerController::GetInstance(); 239 controller_ = ChromeCleanerController::GetInstance();
219 ASSERT_TRUE(controller_); 240 ASSERT_TRUE(controller_);
220 241
221 scoped_feature_list_.InitAndEnableFeature(kInBrowserCleanerUIFeature); 242 scoped_feature_list_.InitAndEnableFeature(kInBrowserCleanerUIFeature);
222 SetChromeCleanerRunnerTestDelegateForTesting(this); 243 SetChromeCleanerRunnerTestDelegateForTesting(this);
223 controller_->SetDelegateForTesting(this); 244 controller_->SetDelegateForTesting(this);
224 } 245 }
225 246
226 void TearDown() override { 247 void TearDown() override {
227 if (controller_->state() == State::kRebootRequired) 248 if (controller_->state() == State::kRebootRequired)
228 controller_->DismissRebootForTesting(); 249 controller_->DismissRebootForTesting();
229 250
230 controller_->SetDelegateForTesting(nullptr); 251 controller_->SetDelegateForTesting(nullptr);
231 SetChromeCleanerRunnerTestDelegateForTesting(nullptr); 252 SetChromeCleanerRunnerTestDelegateForTesting(nullptr);
253 profile_manager_.DeleteAllTestingProfiles();
232 } 254 }
233 255
256 TestingProfileManager* profile_manager() { return &profile_manager_; }
257
234 // ChromeCleanerControllerDelegate overrides. 258 // ChromeCleanerControllerDelegate overrides.
235 259
236 void FetchAndVerifyChromeCleaner(FetchedCallback fetched_callback) override { 260 void FetchAndVerifyChromeCleaner(FetchedCallback fetched_callback) override {
237 base::ThreadTaskRunnerHandle::Get()->PostTask( 261 base::ThreadTaskRunnerHandle::Get()->PostTask(
238 FROM_HERE, 262 FROM_HERE,
239 base::BindOnce( 263 base::BindOnce(
240 std::move(fetched_callback), 264 std::move(fetched_callback),
241 process_status_ != CleanerProcessStatus::kFetchFailure 265 process_status_ != CleanerProcessStatus::kFetchFailure
242 ? base::FilePath(FILE_PATH_LITERAL("chrome_cleaner.exe")) 266 ? base::FilePath(FILE_PATH_LITERAL("chrome_cleaner.exe"))
243 : base::FilePath())); 267 : base::FilePath()));
244 } 268 }
245 269
246 bool SafeBrowsingExtendedReportingScoutEnabled() override { 270 bool SafeBrowsingExtendedReportingScoutEnabled() override {
247 // Returning an arbitrary value since this is not being tested in this 271 // Returning an arbitrary value since this is not being tested in this
248 // fixture. 272 // fixture.
249 return false; 273 return false;
250 } 274 }
251 275
252 bool IsMetricsAndCrashReportingEnabled() override { 276 bool IsMetricsAndCrashReportingEnabled() override {
253 // Returning an arbitrary value since this is not being tested in this 277 // Returning an arbitrary value since this is not being tested in this
254 // fixture. 278 // fixture.
255 return false; 279 return false;
256 } 280 }
257 281
282 void InvokeTagForResetting(Profile* profile) override {
283 profiles_tagged_.push_back(profile);
284 }
285
286 void InvokeResetTaggedProfiles(std::vector<Profile*> profiles,
287 base::OnceClosure continuation) override {
288 for (Profile* profile : profiles)
289 profiles_to_reset_if_tagged_.push_back(profile);
290 std::move(continuation).Run();
291 }
292
258 // ChromeCleanerRunnerTestDelegate overrides. 293 // ChromeCleanerRunnerTestDelegate overrides.
259 294
260 base::Process LaunchTestProcess( 295 base::Process LaunchTestProcess(
261 const base::CommandLine& command_line, 296 const base::CommandLine& command_line,
262 const base::LaunchOptions& launch_options) override { 297 const base::LaunchOptions& launch_options) override {
263 if (process_status_ != CleanerProcessStatus::kFetchSuccessValidProcess) 298 if (process_status_ != CleanerProcessStatus::kFetchSuccessValidProcess)
264 return base::Process(); 299 return base::Process();
265 300
266 // Add switches and program name that the test process needs for the multi 301 // Add switches and program name that the test process needs for the multi
267 // process tests. 302 // process tests.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 crash_point_ != CrashPoint::kAfterRequestSent && 340 crash_point_ != CrashPoint::kAfterRequestSent &&
306 user_response_ == UserResponse::kAccepted; 341 user_response_ == UserResponse::kAccepted;
307 } 342 }
308 343
309 bool ExpectedOnRebootRequiredCalled() { 344 bool ExpectedOnRebootRequiredCalled() {
310 return ExpectedFinalState() == State::kRebootRequired; 345 return ExpectedFinalState() == State::kRebootRequired;
311 } 346 }
312 347
313 bool ExpectedUwsFound() { return ExpectedOnInfectedCalled(); } 348 bool ExpectedUwsFound() { return ExpectedOnInfectedCalled(); }
314 349
350 bool ExpectedToTagProfile() {
351 return process_status_ == CleanerProcessStatus::kFetchSuccessValidProcess &&
352 (crash_point_ == CrashPoint::kNone ||
353 crash_point_ == CrashPoint::kAfterResponseReceived) &&
354 (uws_found_status_ == UwsFoundStatus::kUwsFoundNoRebootRequired ||
355 uws_found_status_ == UwsFoundStatus::kUwsFoundRebootRequired) &&
356 user_response_ == UserResponse::kAccepted;
357 }
358
359 bool ExpectedToResetSettings() {
360 return process_status_ == CleanerProcessStatus::kFetchSuccessValidProcess &&
361 crash_point_ == CrashPoint::kNone &&
362 uws_found_status_ == UwsFoundStatus::kUwsFoundNoRebootRequired &&
363 user_response_ == UserResponse::kAccepted;
364 }
365
315 ChromeCleanerController::IdleReason ExpectedIdleReason() { 366 ChromeCleanerController::IdleReason ExpectedIdleReason() {
316 EXPECT_EQ(ExpectedFinalState(), State::kIdle); 367 EXPECT_EQ(ExpectedFinalState(), State::kIdle);
317 368
318 if (process_status_ != CleanerProcessStatus::kFetchSuccessValidProcess || 369 if (process_status_ != CleanerProcessStatus::kFetchSuccessValidProcess ||
319 crash_point_ == CrashPoint::kOnStartup || 370 crash_point_ == CrashPoint::kOnStartup ||
320 crash_point_ == CrashPoint::kAfterConnection) { 371 crash_point_ == CrashPoint::kAfterConnection) {
321 return IdleReason::kScanningFailed; 372 return IdleReason::kScanningFailed;
322 } 373 }
323 374
324 if (uws_found_status_ == UwsFoundStatus::kNoUwsFound) 375 if (uws_found_status_ == UwsFoundStatus::kNoUwsFound)
(...skipping 23 matching lines...) Expand all
348 399
349 CleanerProcessStatus process_status_; 400 CleanerProcessStatus process_status_;
350 MockChromeCleanerProcess::CrashPoint crash_point_; 401 MockChromeCleanerProcess::CrashPoint crash_point_;
351 UwsFoundStatus uws_found_status_; 402 UwsFoundStatus uws_found_status_;
352 ChromeCleanerController::UserResponse user_response_; 403 ChromeCleanerController::UserResponse user_response_;
353 404
354 MockChromeCleanerProcess::Options cleaner_process_options_; 405 MockChromeCleanerProcess::Options cleaner_process_options_;
355 406
356 StrictMock<MockChromeCleanerControllerObserver> mock_observer_; 407 StrictMock<MockChromeCleanerControllerObserver> mock_observer_;
357 ChromeCleanerController* controller_; 408 ChromeCleanerController* controller_;
409
410 TestingProfileManager profile_manager_;
411 std::vector<Profile*> profiles_tagged_;
412 std::vector<Profile*> profiles_to_reset_if_tagged_;
358 }; 413 };
359 414
360 MULTIPROCESS_TEST_MAIN(MockChromeCleanerProcessMain) { 415 MULTIPROCESS_TEST_MAIN(MockChromeCleanerProcessMain) {
361 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 416 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
362 MockChromeCleanerProcess::Options options; 417 MockChromeCleanerProcess::Options options;
363 EXPECT_TRUE(MockChromeCleanerProcess::Options::FromCommandLine(*command_line, 418 EXPECT_TRUE(MockChromeCleanerProcess::Options::FromCommandLine(*command_line,
364 &options)); 419 &options));
365 420
366 std::string chrome_mojo_pipe_token = command_line->GetSwitchValueASCII( 421 std::string chrome_mojo_pipe_token = command_line->GetSwitchValueASCII(
367 chrome_cleaner::kChromeMojoPipeTokenSwitch); 422 chrome_cleaner::kChromeMojoPipeTokenSwitch);
368 EXPECT_FALSE(chrome_mojo_pipe_token.empty()); 423 EXPECT_FALSE(chrome_mojo_pipe_token.empty());
369 424
370 // Since failures in any of the above calls to EXPECT_*() do not actually fail 425 // Since failures in any of the above calls to EXPECT_*() do not actually fail
371 // the test, we need to ensure that we return an exit code to indicate test 426 // the test, we need to ensure that we return an exit code to indicate test
372 // failure in such cases. 427 // failure in such cases.
373 if (::testing::Test::HasFailure()) 428 if (::testing::Test::HasFailure())
374 return MockChromeCleanerProcess::kInternalTestFailureExitCode; 429 return MockChromeCleanerProcess::kInternalTestFailureExitCode;
375 430
376 MockChromeCleanerProcess mock_cleaner_process(options, 431 MockChromeCleanerProcess mock_cleaner_process(options,
377 chrome_mojo_pipe_token); 432 chrome_mojo_pipe_token);
378 return mock_cleaner_process.Run(); 433 return mock_cleaner_process.Run();
379 } 434 }
380 435
381 TEST_P(ChromeCleanerControllerTest, WithMockCleanerProcess) { 436 TEST_P(ChromeCleanerControllerTest, WithMockCleanerProcess) {
437 Profile* profile1 = profile_manager()->CreateTestingProfile("Test 1");
438 ASSERT_TRUE(profile1);
439 Profile* profile2 = profile_manager()->CreateTestingProfile("Test 2");
440 ASSERT_TRUE(profile2);
441 const int num_profiles =
442 profile_manager()->profile_manager()->GetNumberOfProfiles();
443 ASSERT_EQ(2, num_profiles);
444
382 EXPECT_CALL(mock_observer_, OnIdle(_)).Times(1); 445 EXPECT_CALL(mock_observer_, OnIdle(_)).Times(1);
383 controller_->AddObserver(&mock_observer_); 446 controller_->AddObserver(&mock_observer_);
384 EXPECT_EQ(controller_->state(), State::kIdle); 447 EXPECT_EQ(controller_->state(), State::kIdle);
385 448
386 EXPECT_CALL(mock_observer_, OnScanning()).Times(1); 449 EXPECT_CALL(mock_observer_, OnScanning()).Times(1);
387 controller_->Scan(GetInvocationWithPromptTrigger()); 450 controller_->Scan(GetInvocationWithPromptTrigger());
388 EXPECT_EQ(controller_->state(), State::kScanning); 451 EXPECT_EQ(controller_->state(), State::kScanning);
389 452
390 base::RunLoop run_loop; 453 base::RunLoop run_loop;
391 454
392 std::set<base::FilePath> files_to_delete_on_infected; 455 std::set<base::FilePath> files_to_delete_on_infected;
393 std::set<base::FilePath> files_to_delete_on_cleaning; 456 std::set<base::FilePath> files_to_delete_on_cleaning;
394 457
395 if (ExpectedOnIdleCalled()) { 458 if (ExpectedOnIdleCalled()) {
396 EXPECT_CALL(mock_observer_, OnIdle(ExpectedIdleReason())) 459 EXPECT_CALL(mock_observer_, OnIdle(ExpectedIdleReason()))
397 .WillOnce( 460 .WillOnce(
398 InvokeWithoutArgs([&run_loop]() { run_loop.QuitWhenIdle(); })); 461 InvokeWithoutArgs([&run_loop]() { run_loop.QuitWhenIdle(); }));
399 } 462 }
400 463
401 if (ExpectedOnInfectedCalled()) { 464 if (ExpectedOnInfectedCalled()) {
402 EXPECT_CALL(mock_observer_, OnInfected(_)) 465 EXPECT_CALL(mock_observer_, OnInfected(_))
403 .WillOnce(DoAll(SaveArg<0>(&files_to_delete_on_infected), 466 .WillOnce(DoAll(SaveArg<0>(&files_to_delete_on_infected),
404 InvokeWithoutArgs([this]() { 467 InvokeWithoutArgs([this, profile1]() {
405 controller_->ReplyWithUserResponse(user_response_); 468 controller_->ReplyWithUserResponse(profile1,
469 user_response_);
406 }))); 470 })));
407 } 471 }
408 472
409 if (ExpectedOnCleaningCalled()) { 473 if (ExpectedOnCleaningCalled()) {
410 EXPECT_CALL(mock_observer_, OnCleaning(_)) 474 EXPECT_CALL(mock_observer_, OnCleaning(_))
411 .WillOnce(SaveArg<0>(&files_to_delete_on_cleaning)); 475 .WillOnce(SaveArg<0>(&files_to_delete_on_cleaning));
412 } 476 }
413 477
414 if (ExpectedOnRebootRequiredCalled()) { 478 if (ExpectedOnRebootRequiredCalled()) {
415 EXPECT_CALL(mock_observer_, OnRebootRequired()) 479 EXPECT_CALL(mock_observer_, OnRebootRequired())
416 .WillOnce( 480 .WillOnce(
417 InvokeWithoutArgs([&run_loop]() { run_loop.QuitWhenIdle(); })); 481 InvokeWithoutArgs([&run_loop]() { run_loop.QuitWhenIdle(); }));
418 } 482 }
419 483
420 // Assert here that we expect at least one of OnIdle or OnRebootRequired to be 484 // Assert here that we expect at least one of OnIdle or OnRebootRequired to be
421 // called, since otherwise, the test is set up incorrectly and is expected to 485 // called, since otherwise, the test is set up incorrectly and is expected to
422 // never stop. 486 // never stop.
423 ASSERT_TRUE(ExpectedOnIdleCalled() || ExpectedOnRebootRequiredCalled()); 487 ASSERT_TRUE(ExpectedOnIdleCalled() || ExpectedOnRebootRequiredCalled());
424 run_loop.Run(); 488 run_loop.Run();
425 489
426 EXPECT_EQ(controller_->state(), ExpectedFinalState()); 490 EXPECT_EQ(controller_->state(), ExpectedFinalState());
427 EXPECT_EQ(!files_to_delete_on_infected.empty(), ExpectedUwsFound()); 491 EXPECT_EQ(!files_to_delete_on_infected.empty(), ExpectedUwsFound());
428 EXPECT_EQ(!files_to_delete_on_cleaning.empty(), 492 EXPECT_EQ(!files_to_delete_on_cleaning.empty(),
429 ExpectedUwsFound() && ExpectedOnCleaningCalled()); 493 ExpectedUwsFound() && ExpectedOnCleaningCalled());
430 if (!files_to_delete_on_infected.empty() && 494 if (!files_to_delete_on_infected.empty() &&
431 !files_to_delete_on_cleaning.empty()) { 495 !files_to_delete_on_cleaning.empty()) {
432 EXPECT_EQ(files_to_delete_on_infected, files_to_delete_on_cleaning); 496 EXPECT_EQ(files_to_delete_on_infected, files_to_delete_on_cleaning);
433 } 497 }
434 498
499 std::vector<Profile*> expected_tagged;
500 if (ExpectedToTagProfile())
501 expected_tagged.push_back(profile1);
502 EXPECT_THAT(expected_tagged, UnorderedElementsAreArray(profiles_tagged_));
503
504 std::vector<Profile*> expected_reset_if_tagged;
505 if (ExpectedToResetSettings()) {
506 expected_reset_if_tagged.push_back(profile1);
507 expected_reset_if_tagged.push_back(profile2);
508 }
509 EXPECT_THAT(expected_reset_if_tagged,
510 UnorderedElementsAreArray(profiles_to_reset_if_tagged_));
511
435 controller_->RemoveObserver(&mock_observer_); 512 controller_->RemoveObserver(&mock_observer_);
436 } 513 }
437 514
438 INSTANTIATE_TEST_CASE_P( 515 INSTANTIATE_TEST_CASE_P(
439 All, 516 All,
440 ChromeCleanerControllerTest, 517 ChromeCleanerControllerTest,
441 Combine(Values(CleanerProcessStatus::kFetchFailure, 518 Combine(Values(CleanerProcessStatus::kFetchFailure,
442 CleanerProcessStatus::kFetchSuccessInvalidProcess, 519 CleanerProcessStatus::kFetchSuccessInvalidProcess,
443 CleanerProcessStatus::kFetchSuccessValidProcess), 520 CleanerProcessStatus::kFetchSuccessValidProcess),
444 Values(CrashPoint::kNone, 521 Values(CrashPoint::kNone,
445 CrashPoint::kOnStartup, 522 CrashPoint::kOnStartup,
446 CrashPoint::kAfterConnection, 523 CrashPoint::kAfterConnection,
447 // CrashPoint::kAfterRequestSent is not used because we 524 // CrashPoint::kAfterRequestSent is not used because we
448 // cannot ensure the order between the Mojo request being 525 // cannot ensure the order between the Mojo request being
449 // received by Chrome and the connection being lost. 526 // received by Chrome and the connection being lost.
450 CrashPoint::kAfterResponseReceived), 527 CrashPoint::kAfterResponseReceived),
451 Values(UwsFoundStatus::kNoUwsFound, 528 Values(UwsFoundStatus::kNoUwsFound,
452 UwsFoundStatus::kUwsFoundRebootRequired, 529 UwsFoundStatus::kUwsFoundRebootRequired,
453 UwsFoundStatus::kUwsFoundNoRebootRequired), 530 UwsFoundStatus::kUwsFoundNoRebootRequired),
454 Values(UserResponse::kAccepted, 531 Values(UserResponse::kAccepted,
455 UserResponse::kDenied, 532 UserResponse::kDenied,
456 UserResponse::kDismissed))); 533 UserResponse::kDismissed)));
457 534
458 } // namespace 535 } // namespace
459 } // namespace safe_browsing 536 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698