Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
test_protobuf_client.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_TEST_CLIENT_H_
21 #define MIR_TEST_TEST_CLIENT_H_
22 
23 #include "mir_protobuf.pb.h"
24 
25 #include <gmock/gmock.h>
26 
27 #include <memory>
28 #include <atomic>
29 
30 namespace mir
31 {
32 namespace test
33 {
34 namespace doubles
35 {
36 class MockRpcReport;
37 }
39 {
40  TestProtobufClient(std::string socket_file, int timeout_ms);
41 
42  std::shared_ptr<doubles::MockRpcReport> rpc_report;
43  std::shared_ptr<google::protobuf::RpcChannel> channel;
44  mir::protobuf::DisplayServer::Stub display_server;
45  mir::protobuf::ConnectParameters connect_parameters;
46  mir::protobuf::SurfaceParameters surface_parameters;
47  mir::protobuf::Surface surface;
48  mir::protobuf::Void ignored;
49  mir::protobuf::Connection connection;
50  mir::protobuf::DisplayConfiguration disp_config;
51  mir::protobuf::DisplayConfiguration disp_config_response;
52 
53  MOCK_METHOD0(connect_done, void());
54  MOCK_METHOD0(create_surface_done, void());
55  MOCK_METHOD0(next_buffer_done, void());
56  MOCK_METHOD0(release_surface_done, void());
57  MOCK_METHOD0(disconnect_done, void());
58  MOCK_METHOD0(drm_auth_magic_done, void());
59  MOCK_METHOD0(display_configure_done, void());
60 
61  void on_connect_done();
62 
64 
65  void on_next_buffer_done();
66 
68 
69  void on_disconnect_done();
70 
72 
74 
75  void wait_for_connect_done();
76 
78 
79  void wait_for_next_buffer();
80 
82 
84 
86 
87  void wait_for_surface_count(int count);
88 
89  void wait_for_disconnect_count(int count);
90 
91  void tfd_done();
92 
93  void wait_for_tfd_done();
94 
96 
97  const int maxwait;
98  std::atomic<bool> connect_done_called;
99  std::atomic<bool> create_surface_called;
100  std::atomic<bool> next_buffer_called;
101  std::atomic<bool> release_surface_called;
102  std::atomic<bool> disconnect_done_called;
103  std::atomic<bool> drm_auth_magic_done_called;
104  std::atomic<bool> configure_display_done_called;
105  std::atomic<bool> tfd_done_called;
106 
107  std::atomic<int> connect_done_count;
108  std::atomic<int> create_surface_done_count;
109  std::atomic<int> disconnect_done_count;
110 };
111 }
112 }
113 #endif /* MIR_TEST_TEST_CLIENT_H_ */

Copyright © 2012,2013 Canonical Ltd.
Generated on Wed Oct 30 18:52:19 UTC 2013