| Index: content/test/fake_service_registry.h
|
| diff --git a/content/test/fake_service_registry.h b/content/test/fake_service_registry.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..732664c70a82d0e0fbfd8958dd0957d44741d28c
|
| --- /dev/null
|
| +++ b/content/test/fake_service_registry.h
|
| @@ -0,0 +1,43 @@
|
| +// 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.
|
| +
|
| +#ifndef CONTENT_TEST_FAKE_SERVICE_REGISTRY_H_
|
| +#define CONTENT_TEST_FAKE_SERVICE_REGISTRY_H_
|
| +
|
| +#include <map>
|
| +#include <string>
|
| +
|
| +#include "base/macros.h"
|
| +#include "content/public/common/service_registry.h"
|
| +
|
| +namespace content {
|
| +
|
| +// An in-process ServiceRegistry. Connecting to a "remote" service connects to
|
| +// one added locally.
|
| +class FakeServiceRegistry : public ServiceRegistry {
|
| + public:
|
| + using ServiceRegistry::AddService;
|
| +
|
| + FakeServiceRegistry();
|
| + ~FakeServiceRegistry() override;
|
| +
|
| + // |ServiceRegistry| implementation.
|
| + void AddService(const std::string& service_name,
|
| + const base::Callback<void(mojo::ScopedMessagePipeHandle)>
|
| + service_factory) override;
|
| + void RemoveService(const std::string& service_name) override;
|
| + void ConnectToRemoteService(const base::StringPiece& name,
|
| + mojo::ScopedMessagePipeHandle handle) override;
|
| +
|
| + private:
|
| + using ServiceMap = std::map<std::string,
|
| + base::Callback<void(mojo::ScopedMessagePipeHandle)>>;
|
| + ServiceMap service_map_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(FakeServiceRegistry);
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_TEST_FAKE_SERVICE_REGISTRY_H_
|
|
|