| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/public/test/fake_associated_interface_provider_impl.h" |
| 6 |
| 7 namespace content { |
| 8 |
| 9 FakeAssociatedInterfaceProviderImpl::FakeAssociatedInterfaceProviderImpl() { |
| 10 remote_controller_ = mojo::GetRemoteGroupControllerForTesting(&foo_ptr_); |
| 11 } |
| 12 |
| 13 FakeAssociatedInterfaceProviderImpl::~FakeAssociatedInterfaceProviderImpl() {} |
| 14 |
| 15 void FakeAssociatedInterfaceProviderImpl::GetInterface( |
| 16 const std::string& name, |
| 17 mojo::ScopedInterfaceEndpointHandle handle) { |
| 18 auto it = binders_.find(name); |
| 19 if (it != binders_.end()) { |
| 20 mojo::ScopedInterfaceEndpointHandle local_handle = |
| 21 remote_controller_->CreateLocalEndpointHandle(handle.release()); |
| 22 DCHECK(local_handle.is_local()); |
| 23 it->second.Run(std::move(local_handle)); |
| 24 } |
| 25 } |
| 26 |
| 27 mojo::AssociatedGroup* |
| 28 FakeAssociatedInterfaceProviderImpl::GetAssociatedGroup() { |
| 29 return foo_ptr_.associated_group(); |
| 30 } |
| 31 |
| 32 void FakeAssociatedInterfaceProviderImpl::OverrideBinderForTesting( |
| 33 const std::string& name, |
| 34 const base::Callback<void(mojo::ScopedInterfaceEndpointHandle)>& binder) { |
| 35 binders_[name] = binder; |
| 36 } |
| 37 |
| 38 } // namespace content |
| OLD | NEW |