| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/incident_reporting/last_download_finder.h
" | 5 #include "chrome/browser/safe_browsing/incident_reporting/last_download_finder.h
" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 last_non_binary_download; | 382 last_non_binary_download; |
| 383 RunLastDownloadFinder(&last_binary_download, &last_non_binary_download); | 383 RunLastDownloadFinder(&last_binary_download, &last_non_binary_download); |
| 384 EXPECT_FALSE(last_binary_download); | 384 EXPECT_FALSE(last_binary_download); |
| 385 EXPECT_TRUE(last_non_binary_download); | 385 EXPECT_TRUE(last_non_binary_download); |
| 386 } | 386 } |
| 387 | 387 |
| 388 // Tests that a download is found from a single profile when the field trial is | 388 // Tests that a download is found from a single profile when the field trial is |
| 389 // enabled. | 389 // enabled. |
| 390 TEST_F(LastDownloadFinderTest, SimpleEndToEndFieldTrial) { | 390 TEST_F(LastDownloadFinderTest, SimpleEndToEndFieldTrial) { |
| 391 // Set up a field trial | 391 // Set up a field trial |
| 392 base::FieldTrialList field_trial_list(new base::MockEntropyProvider()); | 392 base::FieldTrialList field_trial_list( |
| 393 base::MakeUnique<base::MockEntropyProvider>()); |
| 393 base::FieldTrialList::CreateFieldTrial("SafeBrowsingIncidentReportingService", | 394 base::FieldTrialList::CreateFieldTrial("SafeBrowsingIncidentReportingService", |
| 394 "Enabled"); | 395 "Enabled"); |
| 395 // Create a profile with a history service that is opted-in to Safe Browsing | 396 // Create a profile with a history service that is opted-in to Safe Browsing |
| 396 // only. | 397 // only. |
| 397 TestingProfile* profile = CreateProfile(SAFE_BROWSING_OPT_IN); | 398 TestingProfile* profile = CreateProfile(SAFE_BROWSING_OPT_IN); |
| 398 | 399 |
| 399 // Add a download. | 400 // Add a download. |
| 400 AddDownload(profile, CreateTestDownloadRow(kBinaryFileName)); | 401 AddDownload(profile, CreateTestDownloadRow(kBinaryFileName)); |
| 401 | 402 |
| 402 std::unique_ptr<ClientIncidentReport_DownloadDetails> last_binary_download; | 403 std::unique_ptr<ClientIncidentReport_DownloadDetails> last_binary_download; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 base::Bind(&LastDownloadFinderTest::OnLastDownload, | 464 base::Bind(&LastDownloadFinderTest::OnLastDownload, |
| 464 base::Unretained(this), &last_binary_download, | 465 base::Unretained(this), &last_binary_download, |
| 465 &last_non_binary_download, run_loop.QuitClosure()))); | 466 &last_non_binary_download, run_loop.QuitClosure()))); |
| 466 | 467 |
| 467 run_loop.Run(); | 468 run_loop.Run(); |
| 468 | 469 |
| 469 ASSERT_TRUE(last_binary_download); | 470 ASSERT_TRUE(last_binary_download); |
| 470 } | 471 } |
| 471 | 472 |
| 472 } // namespace safe_browsing | 473 } // namespace safe_browsing |
| OLD | NEW |