| Index: content/public/test/fake_associated_interface_provider_impl.cc
|
| diff --git a/content/public/test/fake_associated_interface_provider_impl.cc b/content/public/test/fake_associated_interface_provider_impl.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..312930dfd97a0ea34181235b73615573c81fdf30
|
| --- /dev/null
|
| +++ b/content/public/test/fake_associated_interface_provider_impl.cc
|
| @@ -0,0 +1,38 @@
|
| +// Copyright 2016 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 "content/public/test/fake_associated_interface_provider_impl.h"
|
| +
|
| +namespace content {
|
| +
|
| +FakeAssociatedInterfaceProviderImpl::FakeAssociatedInterfaceProviderImpl() {
|
| + remote_controller_ = mojo::GetRemoteGroupControllerForTesting(&foo_ptr_);
|
| +}
|
| +
|
| +FakeAssociatedInterfaceProviderImpl::~FakeAssociatedInterfaceProviderImpl() {}
|
| +
|
| +void FakeAssociatedInterfaceProviderImpl::GetInterface(
|
| + const std::string& name,
|
| + mojo::ScopedInterfaceEndpointHandle handle) {
|
| + auto it = binders_.find(name);
|
| + if (it != binders_.end()) {
|
| + mojo::ScopedInterfaceEndpointHandle local_handle =
|
| + remote_controller_->CreateLocalEndpointHandle(handle.release());
|
| + DCHECK(local_handle.is_local());
|
| + it->second.Run(std::move(local_handle));
|
| + }
|
| +}
|
| +
|
| +mojo::AssociatedGroup*
|
| +FakeAssociatedInterfaceProviderImpl::GetAssociatedGroup() {
|
| + return foo_ptr_.associated_group();
|
| +}
|
| +
|
| +void FakeAssociatedInterfaceProviderImpl::OverrideBinderForTesting(
|
| + const std::string& name,
|
| + const base::Callback<void(mojo::ScopedInterfaceEndpointHandle)>& binder) {
|
| + binders_[name] = binder;
|
| +}
|
| +
|
| +} // namespace content
|
|
|