2
* Copyright © 2012 Canonical Ltd.
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.
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.
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/>.
16
* Authored by: Thomas Voss <thomas.voss@canonical.com>
17
* Alan Griffiths <alan@octopull.co.uk>
20
#ifndef MIR_TEST_TEST_CLIENT_H_
21
#define MIR_TEST_TEST_CLIENT_H_
23
#include "mir_protobuf.pb.h"
24
#include "wait_condition.h"
26
#include <gmock/gmock.h>
39
struct TestProtobufClient
41
TestProtobufClient(std::string socket_file, int timeout_ms);
43
std::shared_ptr<doubles::MockRpcReport> rpc_report;
44
std::shared_ptr<google::protobuf::RpcChannel> channel;
45
mir::protobuf::DisplayServer::Stub display_server;
46
mir::protobuf::ConnectParameters connect_parameters;
47
mir::protobuf::SurfaceParameters surface_parameters;
48
mir::protobuf::Surface surface;
49
mir::protobuf::Void ignored;
50
mir::protobuf::Connection connection;
51
mir::protobuf::DisplayConfiguration disp_config;
52
mir::protobuf::DisplayConfiguration disp_config_response;
53
mir::protobuf::PromptSessionParameters prompt_session_parameters;
54
mir::protobuf::Void prompt_session;
56
MOCK_METHOD0(connect_done, void());
57
MOCK_METHOD0(create_surface_done, void());
58
MOCK_METHOD0(next_buffer_done, void());
59
MOCK_METHOD0(release_surface_done, void());
60
MOCK_METHOD0(disconnect_done, void());
61
MOCK_METHOD0(drm_auth_magic_done, void());
62
MOCK_METHOD0(display_configure_done, void());
63
MOCK_METHOD0(prompt_session_start_done, void());
64
MOCK_METHOD0(prompt_session_stop_done, void());
66
void on_connect_done();
68
void on_create_surface_done();
70
void on_next_buffer_done();
72
void on_release_surface_done();
74
void on_disconnect_done();
76
void on_drm_auth_magic_done();
78
void on_configure_display_done();
80
void wait_for_connect_done();
82
void wait_for_create_surface();
84
void wait_for_next_buffer();
86
void wait_for_release_surface();
88
void wait_for_disconnect_done();
90
void wait_for_drm_auth_magic_done();
92
void wait_for_surface_count(int count);
94
void wait_for_disconnect_count(int count);
98
void wait_for_tfd_done();
100
void wait_for_configure_display_done();
102
void wait_for_prompt_session_start_done();
104
void wait_for_prompt_session_stop_done();
107
std::atomic<bool> connect_done_called;
108
std::atomic<bool> create_surface_called;
109
std::atomic<bool> next_buffer_called;
110
std::atomic<bool> release_surface_called;
111
std::atomic<bool> disconnect_done_called;
112
std::atomic<bool> drm_auth_magic_done_called;
113
std::atomic<bool> configure_display_done_called;
114
std::atomic<bool> tfd_done_called;
116
WaitCondition wc_prompt_session_start;
117
WaitCondition wc_prompt_session_stop;
119
std::atomic<int> connect_done_count;
120
std::atomic<int> create_surface_done_count;
121
std::atomic<int> disconnect_done_count;
125
#endif /* MIR_TEST_TEST_CLIENT_H_ */