Index: extensions/test/service_registration_manager_test_api.cc |
diff --git a/extensions/test/service_registration_manager_test_api.cc b/extensions/test/service_registration_manager_test_api.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d660f2c4560d996bb397125c4c06d0294beae066 |
--- /dev/null |
+++ b/extensions/test/service_registration_manager_test_api.cc |
@@ -0,0 +1,39 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "extensions/test/service_registration_manager_test_api.h" |
+ |
+namespace extensions { |
+namespace internal { |
+ |
+TestServiceRegistrationManager::TestServiceRegistrationManager() { |
+} |
+ |
+TestServiceRegistrationManager::~TestServiceRegistrationManager() { |
+} |
+ |
+void TestServiceRegistrationManager::AddServiceToServiceRegistry( |
+ content::ServiceRegistry* service_registry, |
+ ServiceFactoryBase* factory) { |
+ auto test_factory = test_factories_.find(factory->GetName()); |
+ if (test_factory != test_factories_.end()) { |
+ test_factory->second->Register(service_registry); |
+ } else { |
+ ServiceRegistrationManager::AddServiceToServiceRegistry(service_registry, |
+ factory); |
+ } |
+} |
+ |
+} // namespace internal |
+ |
+ServiceRegistrationManagerTestApi::ServiceRegistrationManagerTestApi() { |
+ ServiceRegistrationManager::SetServiceRegistrationManagerForTest( |
+ &service_registration_manager_); |
+} |
+ |
+ServiceRegistrationManagerTestApi::~ServiceRegistrationManagerTestApi() { |
+ ServiceRegistrationManager::ClearServiceRegistrationManagerForTest(); |
+} |
+ |
+} // namespace extensions |