1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_
#define REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_
#include "remoting/proto/internal.pb.h"
#include "remoting/protocol/client_stub.h"
#include "remoting/protocol/connection_to_client.h"
#include "remoting/protocol/host_stub.h"
#include "remoting/protocol/input_stub.h"
#include "remoting/protocol/session.h"
#include "remoting/protocol/video_stub.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace remoting {
namespace protocol {
class ChromotocolConnection;
class MockConnectionToClient : public ConnectionToClient {
public:
MockConnectionToClient(MessageLoop* message_loop,
EventHandler* handler,
HostStub* host_stub,
InputStub* input_stub);
virtual ~MockConnectionToClient();
MOCK_METHOD1(Init, void(Session* session));
MOCK_METHOD0(video_stub, VideoStub*());
MOCK_METHOD0(client_stub, ClientStub*());
MOCK_METHOD0(session, Session*());
MOCK_METHOD0(Disconnect, void());
private:
DISALLOW_COPY_AND_ASSIGN(MockConnectionToClient);
};
class MockConnectionToClientEventHandler :
public ConnectionToClient::EventHandler {
public:
MockConnectionToClientEventHandler();
virtual ~MockConnectionToClientEventHandler();
MOCK_METHOD1(OnConnectionOpened, void(ConnectionToClient* connection));
MOCK_METHOD1(OnConnectionClosed, void(ConnectionToClient* connection));
MOCK_METHOD1(OnConnectionFailed, void(ConnectionToClient* connection));
MOCK_METHOD2(OnSequenceNumberUpdated, void(ConnectionToClient* connection,
int64 sequence_number));
private:
DISALLOW_COPY_AND_ASSIGN(MockConnectionToClientEventHandler);
};
class MockInputStub : public InputStub {
public:
MockInputStub();
virtual ~MockInputStub();
MOCK_METHOD2(InjectKeyEvent, void(const KeyEvent* event, Task* done));
MOCK_METHOD2(InjectMouseEvent, void(const MouseEvent* event, Task* done));
private:
DISALLOW_COPY_AND_ASSIGN(MockInputStub);
};
class MockHostStub : public HostStub {
public:
MockHostStub();
~MockHostStub();
MOCK_METHOD2(SuggestResolution, void(const SuggestResolutionRequest* msg,
Task* done));
MOCK_METHOD2(BeginSessionRequest,
void(const LocalLoginCredentials* credentials, Task* done));
private:
DISALLOW_COPY_AND_ASSIGN(MockHostStub);
};
class MockClientStub : public ClientStub {
public:
MockClientStub();
virtual ~MockClientStub();
MOCK_METHOD2(NotifyResolution, void(const NotifyResolutionRequest* msg,
Task* done));
MOCK_METHOD2(BeginSessionResponse, void(const LocalLoginStatus* msg,
Task* done));
private:
DISALLOW_COPY_AND_ASSIGN(MockClientStub);
};
class MockVideoStub : public VideoStub {
public:
MockVideoStub();
virtual ~MockVideoStub();
MOCK_METHOD2(ProcessVideoPacket, void(const VideoPacket* video_packet,
Task* done));
MOCK_METHOD0(GetPendingPackets, int());
private:
DISALLOW_COPY_AND_ASSIGN(MockVideoStub);
};
class MockSession : public Session {
public:
MockSession();
virtual ~MockSession();
MOCK_METHOD1(SetStateChangeCallback, void(StateChangeCallback* callback));
MOCK_METHOD0(control_channel, net::Socket*());
MOCK_METHOD0(event_channel, net::Socket*());
MOCK_METHOD0(video_channel, net::Socket*());
MOCK_METHOD0(video_rtp_channel, net::Socket*());
MOCK_METHOD0(video_rtcp_channel, net::Socket*());
MOCK_METHOD0(jid, const std::string&());
MOCK_METHOD0(message_loop, MessageLoop*());
MOCK_METHOD0(candidate_config, const CandidateSessionConfig*());
MOCK_METHOD0(config, const SessionConfig*());
MOCK_METHOD1(set_config, void(const SessionConfig* config));
MOCK_METHOD0(initiator_token, const std::string&());
MOCK_METHOD1(set_initiator_token, void(const std::string& initiator_token));
MOCK_METHOD0(receiver_token, const std::string&());
MOCK_METHOD1(set_receiver_token, void(const std::string& receiver_token));
MOCK_METHOD0(Close, void());
private:
DISALLOW_COPY_AND_ASSIGN(MockSession);
};
} // namespace protocol
} // namespace remoting
#endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_
|