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

Unified Diff: chrome/browser/extensions/api/mdns/mdns_api_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/extensions/api/mdns/mdns_api_unittest.cc
diff --git a/chrome/browser/extensions/api/mdns/mdns_api_unittest.cc b/chrome/browser/extensions/api/mdns/mdns_api_unittest.cc
index 84e1f086745bdbe36debe084ad9c3a4aac1ead38..7c8a190706a426a89028e10d9a2f14fd2e8d95e2 100644
--- a/chrome/browser/extensions/api/mdns/mdns_api_unittest.cc
+++ b/chrome/browser/extensions/api/mdns/mdns_api_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/mdns/mdns_api.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_service_test_base.h"
@@ -10,7 +11,7 @@
#include "content/public/browser/browser_context.h"
#include "content/public/test/mock_render_process_host.h"
#include "extensions/browser/event_router_factory.h"
-#include "extensions/browser/extension_prefs_factory.h"
+#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/manifest_constants.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -20,14 +21,14 @@ namespace extensions {
namespace {
-KeyedService* MDnsAPITestingFactoryFunction(content::BrowserContext* context) {
- return new MDnsAPI(context);
+scoped_ptr<KeyedService> MDnsAPITestingFactoryFunction(
+ content::BrowserContext* context) {
+ return make_scoped_ptr(new MDnsAPI(context));
}
-KeyedService* BuildEventRouter(content::BrowserContext* profile) {
- return new extensions::EventRouter(
- profile,
- ExtensionPrefsFactory::GetInstance()->GetForBrowserContext((profile)));
+scoped_ptr<KeyedService> BuildEventRouter(content::BrowserContext* context) {
+ return make_scoped_ptr(
+ new extensions::EventRouter(context, ExtensionPrefs::Get(context)));
}
// For ExtensionService interface when it requires a path that is not used.
@@ -93,11 +94,6 @@ class MDnsAPITest : public extensions::ExtensionServiceTestBase {
.Times(1);
render_process_host_.reset();
extensions::ExtensionServiceTestBase::TearDown();
- MDnsAPI::GetFactoryInstance()->SetTestingFactory(
- browser_context(),
- nullptr);
-
- registry_ = nullptr;
}
virtual MockDnsSdRegistry* dns_sd_registry() {
@@ -226,10 +222,10 @@ class MockEventRouter : public EventRouter {
MOCK_METHOD1(BroadcastEventPtr, void(Event* event));
};
-KeyedService* MockEventRouterFactoryFunction(content::BrowserContext* profile) {
- return new MockEventRouter(
- profile,
- ExtensionPrefsFactory::GetInstance()->GetForBrowserContext((profile)));
+scoped_ptr<KeyedService> MockEventRouterFactoryFunction(
+ content::BrowserContext* context) {
+ return make_scoped_ptr(
+ new MockEventRouter(context, ExtensionPrefs::Get(context)));
}
class MDnsAPIMaxServicesTest : public MDnsAPITest {

Powered by Google App Engine
This is Rietveld 408576698