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

Unified Diff: chrome/browser/safe_browsing/incident_reporting/last_download_finder_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: Rebase 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/safe_browsing/incident_reporting/last_download_finder_unittest.cc
diff --git a/chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc
index c9d2f8ad7244091b97a86a05a5976a51924106e2..79db3570621b8c4b3960aba9f30d5f7c9a9637f0 100644
--- a/chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc
@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/files/file_util.h"
+#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
@@ -42,7 +43,7 @@ namespace {
// A BrowserContextKeyedServiceFactory::TestingFactoryFunction that creates a
// HistoryService for a TestingProfile.
-KeyedService* BuildHistoryService(content::BrowserContext* context) {
+scoped_ptr<KeyedService> BuildHistoryService(content::BrowserContext* context) {
TestingProfile* profile = static_cast<TestingProfile*>(context);
// Delete the file before creating the service.
@@ -52,21 +53,21 @@ KeyedService* BuildHistoryService(content::BrowserContext* context) {
base::PathExists(history_path)) {
ADD_FAILURE() << "failed to delete history db file "
<< history_path.value();
- return NULL;
+ return scoped_ptr<KeyedService>();
sky 2015/06/08 20:18:49 I believe return nullptr here and 70 should work.
Ilya Sherman 2015/06/08 22:11:43 Good to know! Changed, here and throughout the CL
}
- history::HistoryService* history_service = new history::HistoryService(
- ChromeHistoryClientFactory::GetForProfile(profile),
- scoped_ptr<history::VisitDelegate>());
+ scoped_ptr<history::HistoryService> history_service(
+ new history::HistoryService(
+ ChromeHistoryClientFactory::GetForProfile(profile),
+ scoped_ptr<history::VisitDelegate>()));
if (history_service->Init(
profile->GetPrefs()->GetString(prefs::kAcceptLanguages),
history::HistoryDatabaseParamsForPath(profile->GetPath()))) {
- return history_service;
+ return history_service.Pass();
}
ADD_FAILURE() << "failed to initialize history service";
- delete history_service;
- return NULL;
+ return scoped_ptr<KeyedService>();
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698