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

Side by Side Diff: chrome/browser/extensions/api/management/management_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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/memory/scoped_ptr.h"
5 #include "chrome/browser/extensions/extension_function_test_utils.h" 6 #include "chrome/browser/extensions/extension_function_test_utils.h"
6 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
7 #include "chrome/browser/extensions/extension_service_test_base.h" 8 #include "chrome/browser/extensions/extension_service_test_base.h"
8 #include "chrome/browser/extensions/test_extension_system.h" 9 #include "chrome/browser/extensions/test_extension_system.h"
9 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/host_desktop.h" 11 #include "chrome/browser/ui/host_desktop.h"
11 #include "chrome/test/base/test_browser_window.h" 12 #include "chrome/test/base/test_browser_window.h"
12 #include "extensions/browser/api/management/management_api.h" 13 #include "extensions/browser/api/management/management_api.h"
13 #include "extensions/browser/api/management/management_api_constants.h" 14 #include "extensions/browser/api/management/management_api_constants.h"
14 #include "extensions/browser/event_router_factory.h" 15 #include "extensions/browser/event_router_factory.h"
15 #include "extensions/browser/extension_prefs.h" 16 #include "extensions/browser/extension_prefs.h"
16 #include "extensions/browser/extension_registry.h" 17 #include "extensions/browser/extension_registry.h"
17 #include "extensions/browser/extension_system.h" 18 #include "extensions/browser/extension_system.h"
18 #include "extensions/browser/management_policy.h" 19 #include "extensions/browser/management_policy.h"
19 #include "extensions/browser/test_management_policy.h" 20 #include "extensions/browser/test_management_policy.h"
20 #include "extensions/common/error_utils.h" 21 #include "extensions/common/error_utils.h"
21 #include "extensions/common/extension.h" 22 #include "extensions/common/extension.h"
22 #include "extensions/common/extension_set.h" 23 #include "extensions/common/extension_set.h"
23 #include "extensions/common/test_util.h" 24 #include "extensions/common/test_util.h"
24 25
25 namespace extensions { 26 namespace extensions {
26 27
27 namespace { 28 namespace {
28 29
29 KeyedService* BuildManagementApi(content::BrowserContext* context) { 30 scoped_ptr<KeyedService> BuildManagementApi(content::BrowserContext* context) {
30 return new ManagementAPI(context); 31 return make_scoped_ptr(new ManagementAPI(context));
31 } 32 }
32 33
33 KeyedService* BuildEventRouter(content::BrowserContext* profile) { 34 scoped_ptr<KeyedService> BuildEventRouter(content::BrowserContext* profile) {
34 return new extensions::EventRouter(profile, ExtensionPrefs::Get(profile)); 35 return make_scoped_ptr(
36 new extensions::EventRouter(profile, ExtensionPrefs::Get(profile)));
35 } 37 }
36 38
37 } // namespace 39 } // namespace
38 40
39 namespace constants = extension_management_api_constants; 41 namespace constants = extension_management_api_constants;
40 42
41 // TODO(devlin): Unittests are awesome. Test more with unittests and less with 43 // TODO(devlin): Unittests are awesome. Test more with unittests and less with
42 // heavy api/browser tests. 44 // heavy api/browser tests.
43 class ManagementApiUnitTest : public ExtensionServiceTestBase { 45 class ManagementApiUnitTest : public ExtensionServiceTestBase {
44 protected: 46 protected:
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 uninstall_args.Remove(0u, nullptr); 206 uninstall_args.Remove(0u, nullptr);
205 function = new ManagementUninstallSelfFunction(); 207 function = new ManagementUninstallSelfFunction();
206 function->set_extension(extension); 208 function->set_extension(extension);
207 EXPECT_TRUE(registry()->enabled_extensions().Contains(extension_id)); 209 EXPECT_TRUE(registry()->enabled_extensions().Contains(extension_id));
208 EXPECT_TRUE(RunFunction(function, uninstall_args)) << function->GetError(); 210 EXPECT_TRUE(RunFunction(function, uninstall_args)) << function->GetError();
209 EXPECT_FALSE(registry()->GetExtensionById( 211 EXPECT_FALSE(registry()->GetExtensionById(
210 extension_id, ExtensionRegistry::EVERYTHING)); 212 extension_id, ExtensionRegistry::EVERYTHING));
211 } 213 }
212 214
213 } // namespace extensions 215 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698