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" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "chrome/browser/history/chrome_history_client.h" | 16 #include "chrome/browser/history/chrome_history_client.h" |
17 #include "chrome/browser/history/chrome_history_client_factory.h" | 17 #include "chrome/browser/history/chrome_history_client_factory.h" |
| 18 #include "chrome/browser/history/content_visit_delegate.h" |
18 #include "chrome/browser/history/history_service.h" | 19 #include "chrome/browser/history/history_service.h" |
19 #include "chrome/browser/history/history_service_factory.h" | 20 #include "chrome/browser/history/history_service_factory.h" |
20 #include "chrome/browser/history/web_history_service_factory.h" | 21 #include "chrome/browser/history/web_history_service_factory.h" |
21 #include "chrome/browser/prefs/browser_prefs.h" | 22 #include "chrome/browser/prefs/browser_prefs.h" |
22 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
23 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
25 #include "chrome/common/safe_browsing/csd.pb.h" | 26 #include "chrome/common/safe_browsing/csd.pb.h" |
26 #include "chrome/test/base/testing_browser_process.h" | 27 #include "chrome/test/base/testing_browser_process.h" |
27 #include "chrome/test/base/testing_pref_service_syncable.h" | 28 #include "chrome/test/base/testing_pref_service_syncable.h" |
(...skipping 19 matching lines...) Expand all Loading... |
47 // Delete the file before creating the service. | 48 // Delete the file before creating the service. |
48 base::FilePath history_path( | 49 base::FilePath history_path( |
49 profile->GetPath().Append(history::kHistoryFilename)); | 50 profile->GetPath().Append(history::kHistoryFilename)); |
50 if (!base::DeleteFile(history_path, false) || | 51 if (!base::DeleteFile(history_path, false) || |
51 base::PathExists(history_path)) { | 52 base::PathExists(history_path)) { |
52 ADD_FAILURE() << "failed to delete history db file " | 53 ADD_FAILURE() << "failed to delete history db file " |
53 << history_path.value(); | 54 << history_path.value(); |
54 return NULL; | 55 return NULL; |
55 } | 56 } |
56 | 57 |
57 HistoryService* history_service = new HistoryService( | 58 HistoryService* history_service = |
58 ChromeHistoryClientFactory::GetForProfile(profile), profile); | 59 new HistoryService(ChromeHistoryClientFactory::GetForProfile(profile), |
| 60 scoped_ptr<history::VisitDelegate>()); |
59 if (history_service->Init( | 61 if (history_service->Init( |
60 profile->GetPrefs(), | 62 profile->GetPrefs(), |
61 history::HistoryDatabaseParamsForPath(profile->GetPath()))) { | 63 history::HistoryDatabaseParamsForPath(profile->GetPath()))) { |
62 return history_service; | 64 return history_service; |
63 } | 65 } |
64 | 66 |
65 ADD_FAILURE() << "failed to initialize history service"; | 67 ADD_FAILURE() << "failed to initialize history service"; |
66 delete history_service; | 68 delete history_service; |
67 return NULL; | 69 return NULL; |
68 } | 70 } |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 base::Unretained(this), | 345 base::Unretained(this), |
344 &last_download, | 346 &last_download, |
345 run_loop.QuitClosure()))); | 347 run_loop.QuitClosure()))); |
346 | 348 |
347 run_loop.Run(); | 349 run_loop.Run(); |
348 | 350 |
349 ExpectFoundTestDownload(last_download.Pass()); | 351 ExpectFoundTestDownload(last_download.Pass()); |
350 } | 352 } |
351 | 353 |
352 } // namespace safe_browsing | 354 } // namespace safe_browsing |
OLD | NEW |