| OLD | NEW |
| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/extensions/api/alarms/alarm_manager.h" | |
| 10 #include "chrome/browser/extensions/api/location/location_manager.h" | 9 #include "chrome/browser/extensions/api/location/location_manager.h" |
| 11 #include "chrome/browser/extensions/api/messaging/message_service.h" | 10 #include "chrome/browser/extensions/api/messaging/message_service.h" |
| 12 #include "chrome/browser/extensions/blacklist.h" | 11 #include "chrome/browser/extensions/blacklist.h" |
| 13 #include "chrome/browser/extensions/event_router.h" | 12 #include "chrome/browser/extensions/event_router.h" |
| 14 #include "chrome/browser/extensions/extension_info_map.h" | 13 #include "chrome/browser/extensions/extension_info_map.h" |
| 15 #include "chrome/browser/extensions/extension_pref_value_map.h" | 14 #include "chrome/browser/extensions/extension_pref_value_map.h" |
| 16 #include "chrome/browser/extensions/extension_pref_value_map_factory.h" | 15 #include "chrome/browser/extensions/extension_pref_value_map_factory.h" |
| 17 #include "chrome/browser/extensions/extension_process_manager.h" | 16 #include "chrome/browser/extensions/extension_process_manager.h" |
| 18 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
| 19 #include "chrome/browser/extensions/extension_system.h" | 18 #include "chrome/browser/extensions/extension_system.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 40 } | 39 } |
| 41 | 40 |
| 42 void TestExtensionSystem::Shutdown() { | 41 void TestExtensionSystem::Shutdown() { |
| 43 extension_process_manager_.reset(); | 42 extension_process_manager_.reset(); |
| 44 } | 43 } |
| 45 | 44 |
| 46 void TestExtensionSystem::CreateExtensionProcessManager() { | 45 void TestExtensionSystem::CreateExtensionProcessManager() { |
| 47 extension_process_manager_.reset(ExtensionProcessManager::Create(profile_)); | 46 extension_process_manager_.reset(ExtensionProcessManager::Create(profile_)); |
| 48 } | 47 } |
| 49 | 48 |
| 50 void TestExtensionSystem::CreateAlarmManager(base::Clock* clock) { | |
| 51 alarm_manager_.reset(new AlarmManager(profile_, clock)); | |
| 52 } | |
| 53 | |
| 54 void TestExtensionSystem::CreateSocketManager() { | 49 void TestExtensionSystem::CreateSocketManager() { |
| 55 // Note that we're intentionally creating the socket manager on the wrong | 50 // Note that we're intentionally creating the socket manager on the wrong |
| 56 // thread (not the IO thread). This is because we don't want to presume or | 51 // thread (not the IO thread). This is because we don't want to presume or |
| 57 // require that there be an IO thread in a lightweight test context. If we do | 52 // require that there be an IO thread in a lightweight test context. If we do |
| 58 // need thread-specific behavior someday, we'll probably need something like | 53 // need thread-specific behavior someday, we'll probably need something like |
| 59 // CreateSocketManagerOnThreadForTesting(thread_id). But not today. | 54 // CreateSocketManagerOnThreadForTesting(thread_id). But not today. |
| 60 BrowserThread::ID id; | 55 BrowserThread::ID id; |
| 61 CHECK(BrowserThread::GetCurrentThreadIdentifier(&id)); | 56 CHECK(BrowserThread::GetCurrentThreadIdentifier(&id)); |
| 62 socket_manager_.reset(new ApiResourceManager<Socket>(id)); | 57 socket_manager_.reset(new ApiResourceManager<Socket>(id)); |
| 63 } | 58 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 115 } |
| 121 | 116 |
| 122 UserScriptMaster* TestExtensionSystem::user_script_master() { | 117 UserScriptMaster* TestExtensionSystem::user_script_master() { |
| 123 return NULL; | 118 return NULL; |
| 124 } | 119 } |
| 125 | 120 |
| 126 ExtensionProcessManager* TestExtensionSystem::process_manager() { | 121 ExtensionProcessManager* TestExtensionSystem::process_manager() { |
| 127 return extension_process_manager_.get(); | 122 return extension_process_manager_.get(); |
| 128 } | 123 } |
| 129 | 124 |
| 130 AlarmManager* TestExtensionSystem::alarm_manager() { | |
| 131 return alarm_manager_.get(); | |
| 132 } | |
| 133 | |
| 134 LocationManager* TestExtensionSystem::location_manager() { | 125 LocationManager* TestExtensionSystem::location_manager() { |
| 135 return location_manager_.get(); | 126 return location_manager_.get(); |
| 136 } | 127 } |
| 137 | 128 |
| 138 StateStore* TestExtensionSystem::state_store() { | 129 StateStore* TestExtensionSystem::state_store() { |
| 139 return state_store_.get(); | 130 return state_store_.get(); |
| 140 } | 131 } |
| 141 | 132 |
| 142 StateStore* TestExtensionSystem::rules_store() { | 133 StateStore* TestExtensionSystem::rules_store() { |
| 143 return state_store_.get(); | 134 return state_store_.get(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 Blacklist* TestExtensionSystem::blacklist() { | 184 Blacklist* TestExtensionSystem::blacklist() { |
| 194 return blacklist_.get(); | 185 return blacklist_.get(); |
| 195 } | 186 } |
| 196 | 187 |
| 197 // static | 188 // static |
| 198 ProfileKeyedService* TestExtensionSystem::Build(Profile* profile) { | 189 ProfileKeyedService* TestExtensionSystem::Build(Profile* profile) { |
| 199 return new TestExtensionSystem(profile); | 190 return new TestExtensionSystem(profile); |
| 200 } | 191 } |
| 201 | 192 |
| 202 } // namespace extensions | 193 } // namespace extensions |
| OLD | NEW |