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

Unified Diff: chrome/test/base/testing_profile.cc

Issue 285233012: Abstract history dependencies on bookmarks through HistoryClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 6 years, 7 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/base/testing_profile.cc
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 4e394fc242c26e787c59b04de1df694cae081d28..0173d1ed82f0099698f4c203e35ba6fedcd173c6 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -29,6 +29,7 @@
#include "chrome/browser/geolocation/chrome_geolocation_permission_context.h"
#include "chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h"
#include "chrome/browser/guest_view/guest_view_manager.h"
+#include "chrome/browser/history/chrome_history_client.h"
#include "chrome/browser/history/history_backend.h"
#include "chrome/browser/history/history_db_task.h"
#include "chrome/browser/history/history_service.h"
@@ -95,6 +96,7 @@
using base::Time;
using content::BrowserThread;
using content::DownloadManagerDelegate;
+using history::ChromeHistoryClient;
using testing::NiceMock;
using testing::Return;
@@ -427,7 +429,7 @@ void TestingProfile::CreateFaviconService() {
}
static KeyedService* BuildHistoryService(content::BrowserContext* profile) {
- return new HistoryService(static_cast<Profile*>(profile));
+ return new ChromeHistoryClient(static_cast<Profile*>(profile));
}
bool TestingProfile::CreateHistoryService(bool delete_file, bool no_db) {
@@ -439,12 +441,11 @@ bool TestingProfile::CreateHistoryService(bool delete_file, bool no_db) {
return false;
}
// This will create and init the history service.
- HistoryService* history_service = static_cast<HistoryService*>(
+ ChromeHistoryClient* history_client = static_cast<ChromeHistoryClient*>(
HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse(
this, BuildHistoryService));
- if (!history_service->Init(this->GetPath(),
- BookmarkModelFactory::GetForProfile(this),
- no_db)) {
+ HistoryService* history_service = history_client->history_service();
+ if (!history_service->Init(this->GetPath(), no_db)) {
HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse(this, NULL);
}
// Disable WebHistoryService by default, since it makes network requests.
@@ -514,18 +515,8 @@ void TestingProfile::CreateBookmarkModel(bool delete_file) {
base::DeleteFile(path, false);
}
// This will create a bookmark model.
- BookmarkModel* bookmark_service =
- static_cast<ChromeBookmarkClient*>(
- BookmarkModelFactory::GetInstance()->SetTestingFactoryAndUse(
- this, BuildBookmarkModel))->model();
-
- HistoryService* history_service =
- HistoryServiceFactory::GetForProfileWithoutCreating(this);
- if (history_service) {
- history_service->history_backend_->bookmark_service_ = bookmark_service;
- history_service->history_backend_->expirer_.bookmark_service_ =
- bookmark_service;
- }
+ BookmarkModelFactory::GetInstance()->SetTestingFactoryAndUse(
+ this, BuildBookmarkModel);
}
static KeyedService* BuildWebDataService(content::BrowserContext* profile) {

Powered by Google App Engine
This is Rietveld 408576698