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

Unified Diff: extensions/test/test_service_registration_manager.h

Issue 652313002: Enable the mojo-based serial API in the renderer behind a flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-js-natives-registration
Patch Set: fix windows build Created 6 years, 2 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
« no previous file with comments | « extensions/renderer/module_system.cc ('k') | extensions/test/test_service_registration_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/test/test_service_registration_manager.h
diff --git a/extensions/test/test_service_registration_manager.h b/extensions/test/test_service_registration_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..3bfef63b8a5020bc7fb678b947d356116c90fc95
--- /dev/null
+++ b/extensions/test/test_service_registration_manager.h
@@ -0,0 +1,48 @@
+// 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.
+
+#ifndef EXTENSIONS_TEST_TEST_SERVICE_REGISTRATION_MANAGER_H_
+#define EXTENSIONS_TEST_TEST_SERVICE_REGISTRATION_MANAGER_H_
+
+#include <map>
+#include <string>
+
+#include "extensions/browser/mojo/service_registration_manager.h"
+
+namespace extensions {
+
+class TestServiceRegistrationManager : public ServiceRegistrationManager {
+ public:
+ TestServiceRegistrationManager();
+ ~TestServiceRegistrationManager() override;
+
+ // Overrides an existing service factory with |factory| for testing. This
+ // does not alter the permission checks used to determine whether a service
+ // is available.
+ template <typename Interface>
+ void OverrideServiceFactoryForTest(
+ const base::Callback<void(mojo::InterfaceRequest<Interface>)>& factory) {
+ linked_ptr<internal::ServiceFactoryBase> service_factory(
+ new internal::ServiceFactory<Interface>(factory));
+ auto result = test_factories_.insert(
+ std::make_pair(Interface::Name_, service_factory));
+ DCHECK(result.second);
+ }
+
+ void AddServiceToServiceRegistry(
+ content::ServiceRegistry* service_registry,
+ internal::ServiceFactoryBase* service_factory) override;
+
+ private:
+ std::map<std::string, linked_ptr<internal::ServiceFactoryBase>>
+ test_factories_;
+
+ ServiceRegistrationManager* service_registration_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestServiceRegistrationManager);
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_TEST_TEST_SERVICE_REGISTRATION_MANAGER_H_
« no previous file with comments | « extensions/renderer/module_system.cc ('k') | extensions/test/test_service_registration_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698