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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 // Create a profile with a history service that is opted-in. | 450 // Create a profile with a history service that is opted-in. |
451 CreateProfile(SAFE_BROWSING_AND_EXTENDED_REPORTING); | 451 CreateProfile(SAFE_BROWSING_AND_EXTENDED_REPORTING); |
452 | 452 |
453 std::unique_ptr<ClientIncidentReport_DownloadDetails> last_binary_download; | 453 std::unique_ptr<ClientIncidentReport_DownloadDetails> last_binary_download; |
454 std::unique_ptr<ClientIncidentReport_NonBinaryDownloadDetails> | 454 std::unique_ptr<ClientIncidentReport_NonBinaryDownloadDetails> |
455 last_non_binary_download; | 455 last_non_binary_download; |
456 base::RunLoop run_loop; | 456 base::RunLoop run_loop; |
457 | 457 |
458 // Post a task that will create a second profile once the main loop is run. | 458 // Post a task that will create a second profile once the main loop is run. |
459 base::ThreadTaskRunnerHandle::Get()->PostTask( | 459 base::ThreadTaskRunnerHandle::Get()->PostTask( |
460 FROM_HERE, base::Bind(&LastDownloadFinderTest::CreateProfileWithDownload, | 460 FROM_HERE, |
461 base::Unretained(this))); | 461 base::BindOnce(&LastDownloadFinderTest::CreateProfileWithDownload, |
| 462 base::Unretained(this))); |
462 | 463 |
463 // Create a finder that we expect will find a download in the second profile. | 464 // Create a finder that we expect will find a download in the second profile. |
464 std::unique_ptr<LastDownloadFinder> finder(LastDownloadFinder::Create( | 465 std::unique_ptr<LastDownloadFinder> finder(LastDownloadFinder::Create( |
465 GetDownloadDetailsGetter(), | 466 GetDownloadDetailsGetter(), |
466 base::Bind(&LastDownloadFinderTest::OnLastDownload, | 467 base::Bind(&LastDownloadFinderTest::OnLastDownload, |
467 base::Unretained(this), &last_binary_download, | 468 base::Unretained(this), &last_binary_download, |
468 &last_non_binary_download, run_loop.QuitClosure()))); | 469 &last_non_binary_download, run_loop.QuitClosure()))); |
469 | 470 |
470 run_loop.Run(); | 471 run_loop.Run(); |
471 | 472 |
472 ASSERT_TRUE(last_binary_download); | 473 ASSERT_TRUE(last_binary_download); |
473 } | 474 } |
474 | 475 |
475 } // namespace safe_browsing | 476 } // namespace safe_browsing |
OLD | NEW |