| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef EXTENSIONS_RENDERER_API_TEST_BASE_H_ | 5 #ifndef EXTENSIONS_RENDERER_API_TEST_BASE_H_ |
| 6 #define EXTENSIONS_RENDERER_API_TEST_BASE_H_ | 6 #define EXTENSIONS_RENDERER_API_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 namespace extensions { | 24 namespace extensions { |
| 25 | 25 |
| 26 class V8SchemaRegistry; | 26 class V8SchemaRegistry; |
| 27 | 27 |
| 28 // A ServiceProvider that provides access from JS modules to services registered | 28 // A ServiceProvider that provides access from JS modules to services registered |
| 29 // by AddService() calls. | 29 // by AddService() calls. |
| 30 class TestServiceProvider : public gin::Wrappable<TestServiceProvider> { | 30 class TestServiceProvider : public gin::Wrappable<TestServiceProvider> { |
| 31 public: | 31 public: |
| 32 static gin::Handle<TestServiceProvider> Create(v8::Isolate* isolate); | 32 static gin::Handle<TestServiceProvider> Create(v8::Isolate* isolate); |
| 33 virtual ~TestServiceProvider(); | 33 ~TestServiceProvider() override; |
| 34 | 34 |
| 35 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | 35 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( |
| 36 v8::Isolate* isolate) override; | 36 v8::Isolate* isolate) override; |
| 37 | 37 |
| 38 template <typename Interface> | 38 template <typename Interface> |
| 39 void AddService(const base::Callback<void(mojo::InterfaceRequest<Interface>)> | 39 void AddService(const base::Callback<void(mojo::InterfaceRequest<Interface>)> |
| 40 service_factory) { | 40 service_factory) { |
| 41 service_factories_.insert(std::make_pair( | 41 service_factories_.insert(std::make_pair( |
| 42 Interface::Name_, | 42 Interface::Name_, |
| 43 base::Bind(ForwardToServiceFactory<Interface>, service_factory))); | 43 base::Bind(ForwardToServiceFactory<Interface>, service_factory))); |
| 44 } | 44 } |
| 45 | 45 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 void RunPromisesAgain(); | 85 void RunPromisesAgain(); |
| 86 | 86 |
| 87 base::MessageLoop message_loop_; | 87 base::MessageLoop message_loop_; |
| 88 TestServiceProvider* service_provider_; | 88 TestServiceProvider* service_provider_; |
| 89 scoped_ptr<V8SchemaRegistry> v8_schema_registry_; | 89 scoped_ptr<V8SchemaRegistry> v8_schema_registry_; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 } // namespace extensions | 92 } // namespace extensions |
| 93 | 93 |
| 94 #endif // EXTENSIONS_RENDERER_API_TEST_BASE_H_ | 94 #endif // EXTENSIONS_RENDERER_API_TEST_BASE_H_ |
| OLD | NEW |