~ubuntu-branches/ubuntu/wily/mir/wily-proposed

« back to all changes in this revision

Viewing changes to include/test/mir_test/test_protobuf_client.h

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-10-10 14:01:26 UTC
  • mto: This revision was merged to the branch mainline in revision 84.
  • Revision ID: package-import@ubuntu.com-20141010140126-n1czko8na1kuz4ll
Tags: upstream-0.8.0+14.10.20141010
Import upstream version 0.8.0+14.10.20141010

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
#include "wait_condition.h"
25
 
 
26
 
#include <gmock/gmock.h>
27
 
 
28
 
#include <memory>
29
 
#include <atomic>
30
 
 
31
 
namespace mir
32
 
{
33
 
namespace test
34
 
{
35
 
namespace doubles
36
 
{
37
 
class MockRpcReport;
38
 
}
39
 
struct TestProtobufClient
40
 
{
41
 
    TestProtobufClient(std::string socket_file, int timeout_ms);
42
 
 
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;
55
 
 
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());
65
 
 
66
 
    void on_connect_done();
67
 
 
68
 
    void on_create_surface_done();
69
 
 
70
 
    void on_next_buffer_done();
71
 
 
72
 
    void on_release_surface_done();
73
 
 
74
 
    void on_disconnect_done();
75
 
 
76
 
    void on_drm_auth_magic_done();
77
 
 
78
 
    void on_configure_display_done();
79
 
 
80
 
    void wait_for_connect_done();
81
 
 
82
 
    void wait_for_create_surface();
83
 
 
84
 
    void wait_for_next_buffer();
85
 
 
86
 
    void wait_for_release_surface();
87
 
 
88
 
    void wait_for_disconnect_done();
89
 
 
90
 
    void wait_for_drm_auth_magic_done();
91
 
 
92
 
    void wait_for_surface_count(int count);
93
 
 
94
 
    void wait_for_disconnect_count(int count);
95
 
 
96
 
    void tfd_done();
97
 
 
98
 
    void wait_for_tfd_done();
99
 
 
100
 
    void wait_for_configure_display_done();
101
 
 
102
 
    void wait_for_prompt_session_start_done();
103
 
 
104
 
    void wait_for_prompt_session_stop_done();
105
 
 
106
 
    const int maxwait;
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;
115
 
 
116
 
    WaitCondition wc_prompt_session_start;
117
 
    WaitCondition wc_prompt_session_stop;
118
 
 
119
 
    std::atomic<int> connect_done_count;
120
 
    std::atomic<int> create_surface_done_count;
121
 
    std::atomic<int> disconnect_done_count;
122
 
};
123
 
}
124
 
}
125
 
#endif /* MIR_TEST_TEST_CLIENT_H_ */