Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stub_ipc_factory.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012-2014 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Thomas Voss <thomas.voss@canonical.com>
17  * Alan Griffiths <alan@octopull.co.uk>
18  */
19 
20 #ifndef MIR_TEST_DOUBLES_STUB_IPC_FACTORY_H_
21 #define MIR_TEST_DOUBLES_STUB_IPC_FACTORY_H_
22 
23 #include "mir_test/fake_shared.h"
26 
27 namespace mir
28 {
29 namespace test
30 {
31 namespace doubles
32 {
33 
35 {
36 public:
37  StubIpcFactory(protobuf::DisplayServer& server) :
38  server(fake_shared(server)),
39  cache(std::make_shared<frontend::ResourceCache>())
40  {
41  }
42 
43  std::shared_ptr<protobuf::DisplayServer> make_ipc_server(
44  pid_t, std::shared_ptr<frontend::EventSink> const&) override
45  {
46  return server;
47  }
48 
49 private:
50  virtual std::shared_ptr<frontend::ResourceCache> resource_cache() override
51  {
52  return cache;
53  }
54 
55  std::shared_ptr<protobuf::DisplayServer> server;
56  std::shared_ptr<frontend::ResourceCache> const cache;
57 };
58 
59 }
60 }
61 }
62 
63 #endif /* MIR_TEST_DOUBLES_STUB_IPC_FACTORY_H_ */
std::shared_ptr< Type > fake_shared(Type &t)
Definition: fake_shared.h:31
Definition: stub_ipc_factory.h:34
Definition: protobuf_ipc_factory.h:38
std::shared_ptr< protobuf::DisplayServer > make_ipc_server(pid_t, std::shared_ptr< frontend::EventSink > const &) override
Definition: stub_ipc_factory.h:43
StubIpcFactory(protobuf::DisplayServer &server)
Definition: stub_ipc_factory.h:37

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Apr 11 21:14:53 UTC 2014