| 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 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/history/web_history_service_factory.h" | 21 #include "chrome/browser/history/web_history_service_factory.h" |
| 22 #include "chrome/browser/prefs/browser_prefs.h" | 22 #include "chrome/browser/prefs/browser_prefs.h" |
| 23 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
| 24 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
| 25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 26 #include "chrome/common/safe_browsing/csd.pb.h" | 26 #include "chrome/common/safe_browsing/csd.pb.h" |
| 27 #include "chrome/test/base/testing_browser_process.h" | 27 #include "chrome/test/base/testing_browser_process.h" |
| 28 #include "chrome/test/base/testing_pref_service_syncable.h" | 28 #include "chrome/test/base/testing_pref_service_syncable.h" |
| 29 #include "chrome/test/base/testing_profile.h" | 29 #include "chrome/test/base/testing_profile.h" |
| 30 #include "chrome/test/base/testing_profile_manager.h" | 30 #include "chrome/test/base/testing_profile_manager.h" |
| 31 #include "components/history/core/browser/history_constants.h" |
| 31 #include "content/public/test/test_browser_thread_bundle.h" | 32 #include "content/public/test/test_browser_thread_bundle.h" |
| 32 #include "content/public/test/test_utils.h" | 33 #include "content/public/test/test_utils.h" |
| 33 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
| 34 | 35 |
| 35 namespace { | 36 namespace { |
| 36 | 37 |
| 37 // A BrowserContextKeyedServiceFactory::TestingFactoryFunction that creates a | 38 // A BrowserContextKeyedServiceFactory::TestingFactoryFunction that creates a |
| 38 // HistoryService for a TestingProfile. | 39 // HistoryService for a TestingProfile. |
| 39 KeyedService* BuildHistoryService(content::BrowserContext* context) { | 40 KeyedService* BuildHistoryService(content::BrowserContext* context) { |
| 40 TestingProfile* profile = static_cast<TestingProfile*>(context); | 41 TestingProfile* profile = static_cast<TestingProfile*>(context); |
| 41 | 42 |
| 42 // Delete the file before creating the service. | 43 // Delete the file before creating the service. |
| 43 base::FilePath history_path( | 44 base::FilePath history_path( |
| 44 profile->GetPath().Append(chrome::kHistoryFilename)); | 45 profile->GetPath().Append(history::kHistoryFilename)); |
| 45 if (!base::DeleteFile(history_path, false) || | 46 if (!base::DeleteFile(history_path, false) || |
| 46 base::PathExists(history_path)) { | 47 base::PathExists(history_path)) { |
| 47 ADD_FAILURE() << "failed to delete history db file " | 48 ADD_FAILURE() << "failed to delete history db file " |
| 48 << history_path.value(); | 49 << history_path.value(); |
| 49 return NULL; | 50 return NULL; |
| 50 } | 51 } |
| 51 | 52 |
| 52 HistoryService* history_service = new HistoryService( | 53 HistoryService* history_service = new HistoryService( |
| 53 ChromeHistoryClientFactory::GetForProfile(profile), profile); | 54 ChromeHistoryClientFactory::GetForProfile(profile), profile); |
| 54 if (history_service->Init(profile->GetPath())) | 55 if (history_service->Init(profile->GetPath())) |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 base::Unretained(this), | 334 base::Unretained(this), |
| 334 &last_download, | 335 &last_download, |
| 335 run_loop.QuitClosure()))); | 336 run_loop.QuitClosure()))); |
| 336 | 337 |
| 337 run_loop.Run(); | 338 run_loop.Run(); |
| 338 | 339 |
| 339 ExpectFoundTestDownload(last_download.Pass()); | 340 ExpectFoundTestDownload(last_download.Pass()); |
| 340 } | 341 } |
| 341 | 342 |
| 342 } // namespace safe_browsing | 343 } // namespace safe_browsing |
| OLD | NEW |