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

Unified Diff: content/public/test/fake_associated_interface_provider_impl.cc

Issue 2606593002: [ServiceWorker] Associate interfaces.
Patch Set: Fix unit tests Created 4 years 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 side-by-side diff with in-line comments
Download patch
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
« 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