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

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

Powered by Google App Engine
This is Rietveld 408576698