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

Unified Diff: content/test/fake_service_registry.cc

Issue 1246283003: Split out audio debug recording from RenderProcessHostImpl. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/test/fake_service_registry.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/fake_service_registry.cc
diff --git a/content/test/fake_service_registry.cc b/content/test/fake_service_registry.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7a9a5f162449947709174b6572707d342d6bae81
--- /dev/null
+++ b/content/test/fake_service_registry.cc
@@ -0,0 +1,37 @@
+// Copyright 2015 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/test/fake_service_registry.h"
+
+#include <utility>
+
+#include "base/logging.h"
+#include "base/strings/string_piece.h"
+
+namespace content {
+
+FakeServiceRegistry::FakeServiceRegistry() = default;
+FakeServiceRegistry::~FakeServiceRegistry() = default;
+
+void FakeServiceRegistry::AddService(
+ const std::string& service_name,
+ const base::Callback<void(mojo::ScopedMessagePipeHandle)> service_factory) {
+ DCHECK(service_map_.find(service_name) == service_map_.end());
+ service_map_[service_name] = service_factory;
+}
+
+void FakeServiceRegistry::RemoveService(const std::string& service_name) {
+ auto it = service_map_.find(service_name);
+ DCHECK(it != service_map_.end());
+ service_map_.erase(it);
+}
+
+void FakeServiceRegistry::ConnectToRemoteService(
+ const base::StringPiece& name, mojo::ScopedMessagePipeHandle handle) {
+ auto it = service_map_.find(name.as_string());
+ if (it != service_map_.end())
+ it->second.Run(std::move(handle));
+}
+
+} // namespace content
« no previous file with comments | « content/test/fake_service_registry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698