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

Side by Side Diff: content/public/test/fake_associated_interface_provider_impl.cc

Issue 2606593002: [ServiceWorker] Associate interfaces.
Patch Set: Fix unit tests Created 3 years, 11 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 unified diff | Download patch
OLDNEW
(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
OLDNEW
« no previous file with comments | « content/public/test/fake_associated_interface_provider_impl.h ('k') | content/public/test/foo_interface.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698