Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
stub_ipc_factory.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012 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"
27 
28 namespace mir
29 {
30 namespace test
31 {
32 namespace doubles
33 {
34 
36 {
37 public:
38  StubIpcFactory(protobuf::DisplayServer& server) :
39  server(fake_shared(server)),
40  cache(std::make_shared<frontend::ResourceCache>())
41  {
42  }
43 
44  std::shared_ptr<protobuf::DisplayServer> make_ipc_server(
45  std::shared_ptr<frontend::EventSink> const&, bool)
46  {
47  return server;
48  }
49 
50 private:
51  virtual std::shared_ptr<frontend::ResourceCache> resource_cache()
52  {
53  return cache;
54  }
55 
56  virtual std::shared_ptr<frontend::MessageProcessorReport> report()
57  {
58  return std::make_shared<frontend::NullMessageProcessorReport>();
59  }
60 
61  std::shared_ptr<protobuf::DisplayServer> server;
62  std::shared_ptr<frontend::ResourceCache> const cache;
63 };
64 
65 }
66 }
67 }
68 
69 #endif /* MIR_TEST_DOUBLES_STUB_IPC_FACTORY_H_ */

Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Oct 15 00:23:28 UTC 2013