| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 protected: | 94 protected: |
| 95 // A type for specifying whether or not a profile created by CreateProfile | 95 // A type for specifying whether or not a profile created by CreateProfile |
| 96 // participates in safe browsing. | 96 // participates in safe browsing. |
| 97 enum SafeBrowsingDisposition { | 97 enum SafeBrowsingDisposition { |
| 98 SAFE_BROWSING_OPT_OUT, | 98 SAFE_BROWSING_OPT_OUT, |
| 99 SAFE_BROWSING_OPT_IN, | 99 SAFE_BROWSING_OPT_IN, |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 LastDownloadFinderTest() : profile_number_() {} | 102 LastDownloadFinderTest() : profile_number_() {} |
| 103 | 103 |
| 104 virtual void SetUp() OVERRIDE { | 104 virtual void SetUp() override { |
| 105 testing::Test::SetUp(); | 105 testing::Test::SetUp(); |
| 106 profile_manager_.reset( | 106 profile_manager_.reset( |
| 107 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 107 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
| 108 ASSERT_TRUE(profile_manager_->SetUp()); | 108 ASSERT_TRUE(profile_manager_->SetUp()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 virtual void TearDown() OVERRIDE { | 111 virtual void TearDown() override { |
| 112 // Shut down the history service on all profiles. | 112 // Shut down the history service on all profiles. |
| 113 std::vector<Profile*> profiles( | 113 std::vector<Profile*> profiles( |
| 114 profile_manager_->profile_manager()->GetLoadedProfiles()); | 114 profile_manager_->profile_manager()->GetLoadedProfiles()); |
| 115 for (size_t i = 0; i < profiles.size(); ++i) { | 115 for (size_t i = 0; i < profiles.size(); ++i) { |
| 116 profiles[0]->AsTestingProfile()->DestroyHistoryService(); | 116 profiles[0]->AsTestingProfile()->DestroyHistoryService(); |
| 117 } | 117 } |
| 118 profile_manager_.reset(); | 118 profile_manager_.reset(); |
| 119 TestingBrowserProcess::DeleteInstance(); | 119 TestingBrowserProcess::DeleteInstance(); |
| 120 testing::Test::TearDown(); | 120 testing::Test::TearDown(); |
| 121 } | 121 } |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 safe_browsing::LastDownloadFinder::Create( | 322 safe_browsing::LastDownloadFinder::Create( |
| 323 base::Bind(&LastDownloadFinderTest::OnLastDownload, | 323 base::Bind(&LastDownloadFinderTest::OnLastDownload, |
| 324 base::Unretained(this), | 324 base::Unretained(this), |
| 325 &last_download, | 325 &last_download, |
| 326 run_loop.QuitClosure()))); | 326 run_loop.QuitClosure()))); |
| 327 | 327 |
| 328 run_loop.Run(); | 328 run_loop.Run(); |
| 329 | 329 |
| 330 ExpectFoundTestDownload(last_download.Pass()); | 330 ExpectFoundTestDownload(last_download.Pass()); |
| 331 } | 331 } |
| OLD | NEW |