Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc

Issue 722723005: Move constants used by history component to history namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial patchset Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/download_row.h" 18 #include "chrome/browser/history/download_row.h"
19 #include "chrome/browser/history/history_service.h" 19 #include "chrome/browser/history/history_service.h"
20 #include "chrome/browser/history/history_service_factory.h" 20 #include "chrome/browser/history/history_service_factory.h"
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"
25 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
26 #include "chrome/common/safe_browsing/csd.pb.h" 25 #include "chrome/common/safe_browsing/csd.pb.h"
27 #include "chrome/test/base/testing_browser_process.h" 26 #include "chrome/test/base/testing_browser_process.h"
28 #include "chrome/test/base/testing_pref_service_syncable.h" 27 #include "chrome/test/base/testing_pref_service_syncable.h"
29 #include "chrome/test/base/testing_profile.h" 28 #include "chrome/test/base/testing_profile.h"
30 #include "chrome/test/base/testing_profile_manager.h" 29 #include "chrome/test/base/testing_profile_manager.h"
30 #include "components/history/core/browser/history_constants.h"
31 #include "content/public/test/test_browser_thread_bundle.h" 31 #include "content/public/test/test_browser_thread_bundle.h"
32 #include "content/public/test/test_utils.h" 32 #include "content/public/test/test_utils.h"
33 #include "testing/gtest/include/gtest/gtest.h" 33 #include "testing/gtest/include/gtest/gtest.h"
34 34
35 namespace { 35 namespace {
36 36
37 // A BrowserContextKeyedServiceFactory::TestingFactoryFunction that creates a 37 // A BrowserContextKeyedServiceFactory::TestingFactoryFunction that creates a
38 // HistoryService for a TestingProfile. 38 // HistoryService for a TestingProfile.
39 KeyedService* BuildHistoryService(content::BrowserContext* context) { 39 KeyedService* BuildHistoryService(content::BrowserContext* context) {
40 TestingProfile* profile = static_cast<TestingProfile*>(context); 40 TestingProfile* profile = static_cast<TestingProfile*>(context);
41 41
42 // Delete the file before creating the service. 42 // Delete the file before creating the service.
43 base::FilePath history_path( 43 base::FilePath history_path(
44 profile->GetPath().Append(chrome::kHistoryFilename)); 44 profile->GetPath().Append(history::kHistoryFilename));
45 if (!base::DeleteFile(history_path, false) || 45 if (!base::DeleteFile(history_path, false) ||
46 base::PathExists(history_path)) { 46 base::PathExists(history_path)) {
47 ADD_FAILURE() << "failed to delete history db file " 47 ADD_FAILURE() << "failed to delete history db file "
48 << history_path.value(); 48 << history_path.value();
49 return NULL; 49 return NULL;
50 } 50 }
51 51
52 HistoryService* history_service = new HistoryService( 52 HistoryService* history_service = new HistoryService(
53 ChromeHistoryClientFactory::GetForProfile(profile), profile); 53 ChromeHistoryClientFactory::GetForProfile(profile), profile);
54 if (history_service->Init(profile->GetPath())) 54 if (history_service->Init(profile->GetPath()))
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 base::Unretained(this), 333 base::Unretained(this),
334 &last_download, 334 &last_download,
335 run_loop.QuitClosure()))); 335 run_loop.QuitClosure())));
336 336
337 run_loop.Run(); 337 run_loop.Run();
338 338
339 ExpectFoundTestDownload(last_download.Pass()); 339 ExpectFoundTestDownload(last_download.Pass());
340 } 340 }
341 341
342 } // namespace safe_browsing 342 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698