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

Unified Diff: chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc

Issue 1165913002: [Cleanup] Used scoped pointers in KeyedServiceFactory's SetTestingFactory functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finish renaming profile -> context Created 5 years, 6 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/browser/sync/glue/bookmark_data_type_controller_unittest.cc
diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc b/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc
index 340adc1d3874d6ed326da593d483632e3ffa4a10..9f6c3b0f2aed0705be9aef07246d4576f4b8b5b7 100644
--- a/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc
+++ b/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc
@@ -58,23 +58,25 @@ class HistoryMock : public history::HistoryService {
~HistoryMock() override {}
};
-KeyedService* BuildChromeBookmarkClient(content::BrowserContext* context) {
- return new ChromeBookmarkClient(static_cast<Profile*>(context));
+scoped_ptr<KeyedService> BuildChromeBookmarkClient(
+ content::BrowserContext* context) {
+ return make_scoped_ptr(
+ new ChromeBookmarkClient(static_cast<Profile*>(context)));
}
-KeyedService* BuildBookmarkModelWithoutLoading(
+scoped_ptr<KeyedService> BuildBookmarkModelWithoutLoading(
content::BrowserContext* context) {
Profile* profile = static_cast<Profile*>(context);
ChromeBookmarkClient* bookmark_client =
ChromeBookmarkClientFactory::GetForProfile(profile);
- BookmarkModel* bookmark_model = new BookmarkModel(bookmark_client);
- bookmark_client->Init(bookmark_model);
- return bookmark_model;
+ scoped_ptr<BookmarkModel> bookmark_model(new BookmarkModel(bookmark_client));
+ bookmark_client->Init(bookmark_model.get());
+ return bookmark_model.Pass();
}
-KeyedService* BuildBookmarkModel(content::BrowserContext* context) {
- BookmarkModel* bookmark_model = static_cast<BookmarkModel*>(
- BuildBookmarkModelWithoutLoading(context));
+scoped_ptr<KeyedService> BuildBookmarkModel(content::BrowserContext* context) {
+ scoped_ptr<BookmarkModel> bookmark_model(static_cast<BookmarkModel*>(
+ BuildBookmarkModelWithoutLoading(context).release()));
Profile* profile = static_cast<Profile*>(context);
bookmark_model->Load(profile->GetPrefs(),
profile->GetPrefs()->GetString(prefs::kAcceptLanguages),
@@ -82,11 +84,11 @@ KeyedService* BuildBookmarkModel(content::BrowserContext* context) {
profile->GetIOTaskRunner(),
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::UI));
- return bookmark_model;
+ return bookmark_model.Pass();
}
-KeyedService* BuildHistoryService(content::BrowserContext* profile) {
- return new HistoryMock;
+scoped_ptr<KeyedService> BuildHistoryService(content::BrowserContext* profile) {
+ return scoped_ptr<KeyedService>(new HistoryMock);
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698