OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ | 5 #ifndef REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ |
6 #define REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ | 6 #define REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "net/base/ip_endpoint.h" | 10 #include "net/base/ip_endpoint.h" |
11 #include "remoting/proto/internal.pb.h" | 11 #include "remoting/proto/internal.pb.h" |
12 #include "remoting/proto/video.pb.h" | 12 #include "remoting/proto/video.pb.h" |
13 #include "remoting/protocol/client_stub.h" | 13 #include "remoting/protocol/client_stub.h" |
14 #include "remoting/protocol/clipboard_stub.h" | 14 #include "remoting/protocol/clipboard_stub.h" |
15 #include "remoting/protocol/connection_to_client.h" | 15 #include "remoting/protocol/connection_to_client.h" |
16 #include "remoting/protocol/host_event_stub.h" | 16 #include "remoting/protocol/host_event_stub.h" |
17 #include "remoting/protocol/host_stub.h" | 17 #include "remoting/protocol/host_stub.h" |
18 #include "remoting/protocol/input_stub.h" | 18 #include "remoting/protocol/input_stub.h" |
19 #include "remoting/protocol/session.h" | 19 #include "remoting/protocol/session.h" |
20 #include "remoting/protocol/session_manager.h" | |
20 #include "remoting/protocol/transport.h" | 21 #include "remoting/protocol/transport.h" |
21 #include "remoting/protocol/video_stub.h" | 22 #include "remoting/protocol/video_stub.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
23 | 24 |
24 namespace remoting { | 25 namespace remoting { |
25 namespace protocol { | 26 namespace protocol { |
26 | 27 |
27 class MockConnectionToClient : public ConnectionToClient { | 28 class MockConnectionToClient : public ConnectionToClient { |
28 public: | 29 public: |
29 MockConnectionToClient(Session* session, | 30 MockConnectionToClient(Session* session, |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 MOCK_METHOD0(receiver_token, const std::string&()); | 170 MOCK_METHOD0(receiver_token, const std::string&()); |
170 MOCK_METHOD1(set_receiver_token, void(const std::string& receiver_token)); | 171 MOCK_METHOD1(set_receiver_token, void(const std::string& receiver_token)); |
171 MOCK_METHOD1(set_shared_secret, void(const std::string& secret)); | 172 MOCK_METHOD1(set_shared_secret, void(const std::string& secret)); |
172 MOCK_METHOD0(shared_secret, const std::string&()); | 173 MOCK_METHOD0(shared_secret, const std::string&()); |
173 MOCK_METHOD0(Close, void()); | 174 MOCK_METHOD0(Close, void()); |
174 | 175 |
175 private: | 176 private: |
176 DISALLOW_COPY_AND_ASSIGN(MockSession); | 177 DISALLOW_COPY_AND_ASSIGN(MockSession); |
177 }; | 178 }; |
178 | 179 |
180 class MockSessionManager : public SessionManager { | |
181 public: | |
182 MockSessionManager(); | |
183 virtual ~MockSessionManager(); | |
184 | |
185 MOCK_METHOD2(Init, void(SignalStrategy*, Listener*)); | |
186 MOCK_METHOD4(ConnectPtr, Session*( | |
187 const std::string&, | |
188 Authenticator*, | |
189 CandidateSessionConfig*, | |
190 const Session::StateChangeCallback&)); | |
191 MOCK_METHOD0(Close, void()); | |
192 MOCK_METHOD1(set_authenticator_factory_ptr, void(AuthenticatorFactory*)); | |
193 virtual scoped_ptr<Session> Connect( | |
194 const std::string& host_jid, | |
195 scoped_ptr<Authenticator> authenticator, | |
196 scoped_ptr<CandidateSessionConfig> config, | |
197 const Session::StateChangeCallback& state_change_callback) { | |
198 return scoped_ptr<Session>(ConnectPtr( | |
199 host_jid, | |
200 authenticator.release(), | |
Wez
2012/06/12 21:20:10
Shouldn't these be get(), so that they get clean-u
simonmorris
2012/06/13 16:26:33
Done.
| |
201 config.release(), | |
202 state_change_callback)); | |
203 }; | |
204 virtual void set_authenticator_factory( | |
205 scoped_ptr<AuthenticatorFactory> authenticator_factory) { | |
206 set_authenticator_factory_ptr(authenticator_factory.release()); | |
207 }; | |
208 | |
209 private: | |
210 DISALLOW_COPY_AND_ASSIGN(MockSessionManager); | |
211 }; | |
212 | |
179 } // namespace protocol | 213 } // namespace protocol |
180 } // namespace remoting | 214 } // namespace remoting |
181 | 215 |
182 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ | 216 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ |
OLD | NEW |