Index: content/common/associated_interface_provider_impl.h |
diff --git a/content/common/associated_interface_provider_impl.h b/content/common/associated_interface_provider_impl.h |
index af01ce55427a5ee9fa6916635c7e066d05ca206a..32670b2cbffce197fb0cea46a59f3aa18e773e0c 100644 |
--- a/content/common/associated_interface_provider_impl.h |
+++ b/content/common/associated_interface_provider_impl.h |
@@ -5,10 +5,10 @@ |
#include "content/public/common/associated_interface_provider.h" |
#include <stdint.h> |
+#include <memory> |
#include "base/macros.h" |
#include "content/common/associated_interfaces.mojom.h" |
-#include "mojo/public/cpp/bindings/associated_group.h" |
namespace content { |
@@ -17,16 +17,28 @@ class AssociatedInterfaceProviderImpl : public AssociatedInterfaceProvider { |
// Binds this to a remote mojom::AssociatedInterfaceProvider. |
explicit AssociatedInterfaceProviderImpl( |
mojom::AssociatedInterfaceProviderAssociatedPtr proxy); |
+ // Constructs a local provider with no remote interfaces. This is useful in |
+ // conjunction with OverrideBinderForTesting(), in test environments where |
+ // there may not be a remote |mojom::AssociatedInterfaceProvider| available. |
+ AssociatedInterfaceProviderImpl(); |
~AssociatedInterfaceProviderImpl() override; |
// AssociatedInterfaceProvider: |
void GetInterface(const std::string& name, |
mojo::ScopedInterfaceEndpointHandle handle) override; |
mojo::AssociatedGroup* GetAssociatedGroup() override; |
+ void OverrideBinderForTesting( |
+ const std::string& name, |
+ const base::Callback<void(mojo::ScopedInterfaceEndpointHandle)>& binder) |
+ override; |
private: |
+ class LocalProvider; |
+ |
mojom::AssociatedInterfaceProviderAssociatedPtr proxy_; |
+ std::unique_ptr<LocalProvider> local_provider_; |
+ |
DISALLOW_COPY_AND_ASSIGN(AssociatedInterfaceProviderImpl); |
}; |