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

Side by Side Diff: chrome/browser/extensions/test_extension_system.cc

Issue 10795052: Improve unit testing of socket API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/extensions/test_extension_system.h" 5 #include "chrome/browser/extensions/test_extension_system.h"
6 6
7 #include "chrome/browser/extensions/api/alarms/alarm_manager.h" 7 #include "chrome/browser/extensions/api/alarms/alarm_manager.h"
8 #include "chrome/browser/extensions/extension_devtools_manager.h" 8 #include "chrome/browser/extensions/extension_devtools_manager.h"
9 #include "chrome/browser/extensions/extension_event_router.h" 9 #include "chrome/browser/extensions/extension_event_router.h"
10 #include "chrome/browser/extensions/extension_info_map.h" 10 #include "chrome/browser/extensions/extension_info_map.h"
11 #include "chrome/browser/extensions/extension_message_service.h" 11 #include "chrome/browser/extensions/extension_message_service.h"
12 #include "chrome/browser/extensions/extension_pref_value_map.h" 12 #include "chrome/browser/extensions/extension_pref_value_map.h"
13 #include "chrome/browser/extensions/extension_pref_value_map_factory.h" 13 #include "chrome/browser/extensions/extension_pref_value_map_factory.h"
14 #include "chrome/browser/extensions/extension_process_manager.h" 14 #include "chrome/browser/extensions/extension_process_manager.h"
15 #include "chrome/browser/extensions/extension_service.h" 15 #include "chrome/browser/extensions/extension_service.h"
16 #include "chrome/browser/extensions/extension_system.h" 16 #include "chrome/browser/extensions/extension_system.h"
17 #include "chrome/browser/extensions/state_store.h" 17 #include "chrome/browser/extensions/state_store.h"
18 #include "chrome/browser/extensions/user_script_master.h" 18 #include "chrome/browser/extensions/user_script_master.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/value_store/testing_value_store.h" 20 #include "chrome/browser/value_store/testing_value_store.h"
21 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
22 #include "content/public/browser/browser_thread.h"
23
24 using content::BrowserThread;
22 25
23 namespace extensions { 26 namespace extensions {
24 27
25 TestExtensionSystem::TestExtensionSystem(Profile* profile) 28 TestExtensionSystem::TestExtensionSystem(Profile* profile)
26 : profile_(profile), 29 : profile_(profile),
27 info_map_(new ExtensionInfoMap()) { 30 info_map_(new ExtensionInfoMap()) {
28 } 31 }
29 32
30 TestExtensionSystem::~TestExtensionSystem() { 33 TestExtensionSystem::~TestExtensionSystem() {
31 } 34 }
32 35
33 void TestExtensionSystem::Shutdown() { 36 void TestExtensionSystem::Shutdown() {
34 extension_process_manager_.reset(); 37 extension_process_manager_.reset();
35 } 38 }
36 39
37 void TestExtensionSystem::CreateExtensionProcessManager() { 40 void TestExtensionSystem::CreateExtensionProcessManager() {
38 extension_process_manager_.reset(ExtensionProcessManager::Create(profile_)); 41 extension_process_manager_.reset(ExtensionProcessManager::Create(profile_));
39 } 42 }
40 43
41 void TestExtensionSystem::CreateAlarmManager( 44 void TestExtensionSystem::CreateAlarmManager(
42 AlarmManager::TimeProvider now) { 45 AlarmManager::TimeProvider now) {
43 alarm_manager_.reset(new AlarmManager(profile_, now)); 46 alarm_manager_.reset(new AlarmManager(profile_, now));
44 } 47 }
45 48
49 void TestExtensionSystem::CreateSocketManager() {
50 socket_manager_.reset(new ApiResourceManager<Socket>(BrowserThread::IO));
51 }
52
46 ExtensionService* TestExtensionSystem::CreateExtensionService( 53 ExtensionService* TestExtensionSystem::CreateExtensionService(
47 const CommandLine* command_line, 54 const CommandLine* command_line,
48 const FilePath& install_directory, 55 const FilePath& install_directory,
49 bool autoupdate_enabled) { 56 bool autoupdate_enabled) {
50 bool extensions_disabled = 57 bool extensions_disabled =
51 command_line && command_line->HasSwitch(switches::kDisableExtensions); 58 command_line && command_line->HasSwitch(switches::kDisableExtensions);
52 59
53 // Note that the GetPrefs() creates a TestingPrefService, therefore 60 // Note that the GetPrefs() creates a TestingPrefService, therefore
54 // the extension controlled pref values set in extension_prefs_ 61 // the extension controlled pref values set in extension_prefs_
55 // are not reflected in the pref service. One would need to 62 // are not reflected in the pref service. One would need to
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 RulesRegistryService* TestExtensionSystem::rules_registry_service() { 138 RulesRegistryService* TestExtensionSystem::rules_registry_service() {
132 return NULL; 139 return NULL;
133 } 140 }
134 141
135 ApiResourceManager<SerialConnection>* 142 ApiResourceManager<SerialConnection>*
136 TestExtensionSystem::serial_connection_manager() { 143 TestExtensionSystem::serial_connection_manager() {
137 return NULL; 144 return NULL;
138 } 145 }
139 146
140 ApiResourceManager<Socket>*TestExtensionSystem::socket_manager() { 147 ApiResourceManager<Socket>*TestExtensionSystem::socket_manager() {
141 return NULL; 148 return socket_manager_.get();
142 } 149 }
143 150
144 ApiResourceManager<UsbDeviceResource>* 151 ApiResourceManager<UsbDeviceResource>*
145 TestExtensionSystem::usb_device_resource_manager() { 152 TestExtensionSystem::usb_device_resource_manager() {
146 return NULL; 153 return NULL;
147 } 154 }
148 155
149 // static 156 // static
150 ProfileKeyedService* TestExtensionSystem::Build(Profile* profile) { 157 ProfileKeyedService* TestExtensionSystem::Build(Profile* profile) {
151 return new TestExtensionSystem(profile); 158 return new TestExtensionSystem(profile);
152 } 159 }
153 160
154 } // namespace extensions 161 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698